[Pytest-commit] commit/pytest: hpk42: speedup @ replacement for the massive lists from pytest-bdd :)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Jul 28 13:54:03 CEST 2014


1 new commit in pytest:

https://bitbucket.org/hpk42/pytest/commits/ae861e335daf/
Changeset:   ae861e335daf
Branch:      fix_initial_parsing
User:        hpk42
Date:        2014-07-28 13:53:53
Summary:     speedup @ replacement for the massive lists from pytest-bdd :)
Affected #:  1 file

diff -r ae1f2ff32bfb93cabb8395de20d026364179ba02 -r ae861e335daf21dc2a0480fa540467264016e4cb _pytest/config.py
--- a/_pytest/config.py
+++ b/_pytest/config.py
@@ -862,14 +862,11 @@
     return {}
 
 
+rex_pyat = re.compile(r'(.*\.py)@\d+$')
+
 def node_with_line_number(string):
-    newparts = []
-    for part in string.split("::"):
-        m = re.match(r'.*\.py@\d+$', part)
-        if m is not None:
-            part = part[:part.rfind("@")]
-        newparts.append(part)
-    return "::".join(newparts)
+    return "::".join(rex_pyat.sub(lambda m: m.group(1), part)
+                        for part in string.split("::"))
 
 
 def setns(obj, dic):

Repository URL: https://bitbucket.org/hpk42/pytest/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.


More information about the pytest-commit mailing list