2 new commits in pytest:

https://bitbucket.org/hpk42/pytest/commits/452d4b637b11/
Changeset:   452d4b637b11
User:        hpk42
Date:        2015-02-26 21:02:49+00:00
Summary:     fix issue650: introduce new --doctest-ignore-import-errors option 
courtesy
of Charles Cloud.
Affected #:  2 files

diff -r eeaef9601d3f2996c3bbbc4c0301a859d8bc35b5 -r 
452d4b637b11f0fb13da045f64bbd35148a73cda AUTHORS
--- a/AUTHORS
+++ b/AUTHORS
@@ -47,3 +47,4 @@
 Nicolas Delaby
 Tom Viner
 Dave Hunt
+Charles Cloud

diff -r eeaef9601d3f2996c3bbbc4c0301a859d8bc35b5 -r 
452d4b637b11f0fb13da045f64bbd35148a73cda CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -3,6 +3,10 @@
 
 - add ability to set command line options by environment variable 
PYTEST_ADDOPTS.
 
+- fix issue650: new option ``--docttest-ignore-import-errors`` which
+  will turn import errors in doctests into skips.  Thanks Charles Cloud
+  for the complete PR.
+  
 - fix issue655: work around different ways that cause python2/3
   to leak sys.exc_info into fixtures/tests causing failures in 3rd party code
 


https://bitbucket.org/hpk42/pytest/commits/15d37e250f68/
Changeset:   15d37e250f68
Branch:      issue616
User:        hpk42
Date:        2015-02-27 08:51:53+00:00
Summary:     move conftest visibility tests and their setup into a class, 
accomodates @nicoddemus 's comment
Affected #:  1 file

diff -r 327ead9d7e9b669d1b1a07332b27f46f8fc77d44 -r 
15d37e250f681d62e089aa905d5acb0da7b2a30f testing/test_conftest.py
--- a/testing/test_conftest.py
+++ b/testing/test_conftest.py
@@ -259,88 +259,87 @@
     """)
 
 
-# conftest visibility, related to issue616
+class TestConftestVisibility:
+    def _setup_tree(self, testdir):  # for issue616
+        # example mostly taken from:
+        # 
https://mail.python.org/pipermail/pytest-dev/2014-September/002617.html
+        runner = testdir.mkdir("empty")
+        package = testdir.mkdir("package")
 
-def _setup_tree(testdir):
-    # example mostly taken from:
-    # https://mail.python.org/pipermail/pytest-dev/2014-September/002617.html
-    runner = testdir.mkdir("empty")
-    package = testdir.mkdir("package")
+        package.join("conftest.py").write(dedent("""\
+            import pytest
+            @pytest.fixture
+            def fxtr():
+                return "from-package"
+        """))
+        package.join("test_pkgroot.py").write(dedent("""\
+            def test_pkgroot(fxtr):
+                assert fxtr == "from-package"
+        """))
 
-    package.join("conftest.py").write(dedent("""\
-        import pytest
-        @pytest.fixture
-        def fxtr():
-            return "from-package"
-    """))
-    package.join("test_pkgroot.py").write(dedent("""\
-        def test_pkgroot(fxtr):
-            assert fxtr == "from-package"
-    """))
+        swc = package.mkdir("swc")
+        swc.join("__init__.py").ensure()
+        swc.join("conftest.py").write(dedent("""\
+            import pytest
+            @pytest.fixture
+            def fxtr():
+                return "from-swc"
+        """))
+        swc.join("test_with_conftest.py").write(dedent("""\
+            def test_with_conftest(fxtr):
+                assert fxtr == "from-swc"
 
-    swc = package.mkdir("swc")
-    swc.join("__init__.py").ensure()
-    swc.join("conftest.py").write(dedent("""\
-        import pytest
-        @pytest.fixture
-        def fxtr():
-            return "from-swc"
-    """))
-    swc.join("test_with_conftest.py").write(dedent("""\
-        def test_with_conftest(fxtr):
-            assert fxtr == "from-swc"
+        """))
 
-    """))
+        snc = package.mkdir("snc")
+        snc.join("__init__.py").ensure()
+        snc.join("test_no_conftest.py").write(dedent("""\
+            def test_no_conftest(fxtr):
+                assert fxtr == "from-package"   # No local conftest.py, so 
should
+                                                # use value from parent dir's
 
-    snc = package.mkdir("snc")
-    snc.join("__init__.py").ensure()
-    snc.join("test_no_conftest.py").write(dedent("""\
-        def test_no_conftest(fxtr):
-            assert fxtr == "from-package"   # No local conftest.py, so should
-                                            # use value from parent dir's
+        """))
+        print ("created directory structure:")
+        for x in testdir.tmpdir.visit():
+            print ("   " + x.relto(testdir.tmpdir))
 
-    """))
-    print ("created directory structure:")
-    for x in testdir.tmpdir.visit():
-        print ("   " + x.relto(testdir.tmpdir))
+        return {
+            "runner": runner,
+            "package": package,
+            "swc": swc,
+            "snc": snc}
 
-    return {
-        "runner": runner,
-        "package": package,
-        "swc": swc,
-        "snc": snc}
+    # N.B.: "swc" stands for "subdir with conftest.py"
+    #       "snc" stands for "subdir no [i.e. without] conftest.py"
+    @pytest.mark.parametrize("chdir,testarg,expect_ntests_passed", [
+        ("runner",  "..",               3),
+        ("package", "..",               3),
+        ("swc",     "../..",            3),
+        ("snc",     "../..",            3),
 
-# N.B.: "swc" stands for "subdir with conftest.py"
-#       "snc" stands for "subdir no [i.e. without] conftest.py"
-@pytest.mark.parametrize("chdir,testarg,expect_ntests_passed", [
-    ("runner",  "..",               3),
-    ("package", "..",               3),
-    ("swc",     "../..",            3),
-    ("snc",     "../..",            3),
+        ("runner",  "../package",       3),
+        ("package", ".",                3),
+        ("swc",     "..",               3),
+        ("snc",     "..",               3),
 
-    ("runner",  "../package",       3),
-    ("package", ".",                3),
-    ("swc",     "..",               3),
-    ("snc",     "..",               3),
+        ("runner",  "../package/swc",   1),
+        ("package", "./swc",            1),
+        ("swc",     ".",                1),
+        ("snc",     "../swc",           1),
 
-    ("runner",  "../package/swc",   1),
-    ("package", "./swc",            1),
-    ("swc",     ".",                1),
-    ("snc",     "../swc",           1),
-
-    ("runner",  "../package/snc",   1),
-    ("package", "./snc",            1),
-    ("swc",     "../snc",           1),
-    ("snc",     ".",                1),
-])
-@pytest.mark.issue616
-def test_parsefactories_relative_node_ids(
-        testdir, chdir,testarg, expect_ntests_passed):
-    dirs = _setup_tree(testdir)
-    print("pytest run in cwd: %s" %(
-          dirs[chdir].relto(testdir.tmpdir)))
-    print("pytestarg        : %s" %(testarg))
-    print("expected pass    : %s" %(expect_ntests_passed))
-    with dirs[chdir].as_cwd():
-        reprec = testdir.inline_run(testarg, "-q", "--traceconfig")
-        reprec.assertoutcome(passed=expect_ntests_passed)
+        ("runner",  "../package/snc",   1),
+        ("package", "./snc",            1),
+        ("swc",     "../snc",           1),
+        ("snc",     ".",                1),
+    ])
+    @pytest.mark.issue616
+    def test_parsefactories_relative_node_ids(
+            self, testdir, chdir,testarg, expect_ntests_passed):
+        dirs = self._setup_tree(testdir)
+        print("pytest run in cwd: %s" %(
+              dirs[chdir].relto(testdir.tmpdir)))
+        print("pytestarg        : %s" %(testarg))
+        print("expected pass    : %s" %(expect_ntests_passed))
+        with dirs[chdir].as_cwd():
+            reprec = testdir.inline_run(testarg, "-q", "--traceconfig")
+            reprec.assertoutcome(passed=expect_ntests_passed)

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.
_______________________________________________
pytest-commit mailing list
pytest-commit@python.org
https://mail.python.org/mailman/listinfo/pytest-commit

Reply via email to