Commits

Mike Bayer  committed 87157a9

- add support for py.test
- make test_mako not actually fail if the plugin isn't found, only if it actually fails to load
if found

  • Participants
  • Parent commits da88eb7

Comments (0)

Files changed (3)

 cover-erase = 1
 nologcapture = 1
 where = tests
+
+[pytest]
+addopts= --tb native -v -r fxX
+python_files=tests/*test_*.py

File tests/cache/test_mako.py

 
     def test_entry_point(self):
         import pkg_resources
-        
+
+        # if the entrypoint isn't there, just pass, as the tests can be run
+        # without any setuptools install
         for impl in pkg_resources.iter_entry_points("mako.cache", "dogpile.cache"):
-            print impl
             impl.load()
-            return
-        else:
-            assert 0, "Missing entry point 'dogpile.cache' for 'mako.cache'"
+

File tests/conftest.py

+import inspect
+import pytest
+from _pytest.unittest import is_unittest, UnitTestCase
+
+def pytest_pycollect_makeitem(collector, name, obj):
+    if is_unittest(obj) and not obj.__name__.startswith("_"):
+        return UnitTestCase(name, parent=collector)
+    else:
+        return []
+
+