[Pytest-commit] commit/pytest: jurko: add test: '--markers' listing info from plugins in current folder

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Jan 22 14:31:39 CET 2014


1 new commit in pytest:

https://bitbucket.org/hpk42/pytest/commits/e9d4d4eb38c1/
Changeset:   e9d4d4eb38c1
User:        jurko
Date:        2014-01-22 14:16:39
Summary:     add test: '--markers' listing info from plugins in current folder

When pytest is called with the '--markers' option, it should collect marker
information from the current folder, and they should get loaded and used
correctly before the '--markers' output is constructed.
Affected #:  1 file

diff -r 2cd4476cf6433894acfc0448dc68132368143c3c -r e9d4d4eb38c195bc3913baca20c1b17e4f93c43a testing/test_mark.py
--- a/testing/test_mark.py
+++ b/testing/test_mark.py
@@ -115,6 +115,28 @@
         "*a1some*another marker",
     ])
 
+def test_markers_option_with_plugin_in_current_dir(testdir):
+    testdir.makeconftest('pytest_plugins = "flip_flop"')
+    testdir.makepyfile(flip_flop="""\
+        def pytest_configure(config):
+            config.addinivalue_line("markers", "flip:flop")
+
+        def pytest_generate_tests(metafunc):
+            try:
+                mark = metafunc.function.flipper
+            except AttributeError:
+                return
+            metafunc.parametrize("x", (10, 20))""")
+    testdir.makepyfile("""\
+        import pytest
+        @pytest.mark.flipper
+        def test_example(x):
+            assert x""")
+
+    result = testdir.runpytest("--markers")
+    result.stdout.fnmatch_lines(["*flip*flop*"])
+
+
 def test_mark_on_pseudo_function(testdir):
     testdir.makepyfile("""
         import pytest

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