[pypy-svn] pypy pytest2: fix tests and safe filename construction, and fix another py.test.config glob usage
hpk42
commits-noreply at bitbucket.org
Tue Jan 18 17:11:16 CET 2011
Author: holger krekel <holger at merlinux.eu>
Branch: pytest2
Changeset: r40880:7f5d3e17e290
Date: 2011-01-18 17:09 +0100
http://bitbucket.org/pypy/pypy/changeset/7f5d3e17e290/
Log: fix tests and safe filename construction, and fix another
py.test.config glob usage
diff --git a/pypy/conftest.py b/pypy/conftest.py
--- a/pypy/conftest.py
+++ b/pypy/conftest.py
@@ -539,6 +539,7 @@
s = s.replace("()", "paren")
s = s.replace(".py", "")
s = s.replace(".", "_")
+ s = s.replace(os.sep, "_")
return s
safe_name = staticmethod(safe_name)
diff --git a/pypy/module/cpyext/test/conftest.py b/pypy/module/cpyext/test/conftest.py
--- a/pypy/module/cpyext/test/conftest.py
+++ b/pypy/module/cpyext/test/conftest.py
@@ -1,5 +1,6 @@
import py
-from pypy.conftest import option, gettestobjspace
+import pytest
+from pypy.conftest import gettestobjspace
def pytest_ignore_collect(path, config):
if config.option.runappdirect:
diff --git a/pypy/tool/pytest/test/test_pytestsupport.py b/pypy/tool/pytest/test/test_pytestsupport.py
--- a/pypy/tool/pytest/test/test_pytestsupport.py
+++ b/pypy/tool/pytest/test/test_pytestsupport.py
@@ -138,8 +138,9 @@
def test_one(self):
pass
""")
- ev, = sorter.getreports("pytest_runtest_logreport")
- assert ev.passed
+ evlist = sorter.getcalls("pytest_runtest_makereport")
+ ev = [x for x in evlist if x.call.when == "call"][0]
+ print ev
sfn = ev.item.safe_filename()
print sfn
assert sfn == 'test_safe_filename_test_safe_filename_ExpectTestOne_paren_test_one_1.py'
diff --git a/pypy/translator/c/test/test_genc.py b/pypy/translator/c/test/test_genc.py
--- a/pypy/translator/c/test/test_genc.py
+++ b/pypy/translator/c/test/test_genc.py
@@ -24,8 +24,11 @@
# XXX fish
t.driver.config.translation.countmallocs = True
compiled_fn = t.compile_c()
- if getattr(py.test.config.option, 'view', False):
- t.view()
+ try:
+ if py.test.config.option.view:
+ t.view()
+ except AttributeError:
+ pass
malloc_counters = t.driver.cbuilder.get_malloc_counters()
def checking_fn(*args, **kwds):
if 'expected_extra_mallocs' in kwds:
More information about the Pypy-commit
mailing list