summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-04-11 14:22:59 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-04-11 14:22:59 -0400
commit87157a9a97fdeaa6f089b209eada8bd316e81761 (patch)
treed3068088bb6c6bfcd842b79e69b67412c8779f9e
parentda88eb7fd76c961c5101d35a0d84cbbdd412add0 (diff)
downloaddogpile-cache-87157a9a97fdeaa6f089b209eada8bd316e81761.tar.gz
- 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
-rw-r--r--setup.cfg4
-rw-r--r--tests/cache/test_mako.py9
-rw-r--r--tests/conftest.py11
3 files changed, 19 insertions, 5 deletions
diff --git a/setup.cfg b/setup.cfg
index 7b68742..a7d7a6f 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -16,3 +16,7 @@ with-coverage = 1
cover-erase = 1
nologcapture = 1
where = tests
+
+[pytest]
+addopts= --tb native -v -r fxX
+python_files=tests/*test_*.py \ No newline at end of file
diff --git a/tests/cache/test_mako.py b/tests/cache/test_mako.py
index 03c060c..d3f0656 100644
--- a/tests/cache/test_mako.py
+++ b/tests/cache/test_mako.py
@@ -9,10 +9,9 @@ class MakoTest(TestCase):
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'"
+
diff --git a/tests/conftest.py b/tests/conftest.py
new file mode 100644
index 0000000..1703669
--- /dev/null
+++ b/tests/conftest.py
@@ -0,0 +1,11 @@
+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 []
+
+