summarylogtreecommitdiffstats
path: root/43f3d148738f77f8579caae49f74f8d548d3f0a9.patch
diff options
context:
space:
mode:
authorGuillaume Horel2020-12-18 21:57:59 -0500
committerGuillaume Horel2020-12-18 21:57:59 -0500
commit1e1bd64a1c61d54c49814615f48088ad66e61148 (patch)
treeb552ded5e3262b6f144d5339a27609ea977908f1 /43f3d148738f77f8579caae49f74f8d548d3f0a9.patch
parent8d7c14649ffa77fa3a561ea03846a60362ac9978 (diff)
downloadaur-1e1bd64a1c61d54c49814615f48088ad66e61148.tar.gz
fix tests
Diffstat (limited to '43f3d148738f77f8579caae49f74f8d548d3f0a9.patch')
-rw-r--r--43f3d148738f77f8579caae49f74f8d548d3f0a9.patch122
1 files changed, 122 insertions, 0 deletions
diff --git a/43f3d148738f77f8579caae49f74f8d548d3f0a9.patch b/43f3d148738f77f8579caae49f74f8d548d3f0a9.patch
new file mode 100644
index 000000000000..b6ffb242d8ee
--- /dev/null
+++ b/43f3d148738f77f8579caae49f74f8d548d3f0a9.patch
@@ -0,0 +1,122 @@
+From 43f3d148738f77f8579caae49f74f8d548d3f0a9 Mon Sep 17 00:00:00 2001
+From: Thrasibule <thrasibule@users.noreply.github.com>
+Date: Tue, 29 Sep 2020 12:08:20 -0400
+Subject: [PATCH] Fix DoctestModule construction warning
+
+* use from_parent constructor
+* fix cython example project
+* make tests pass
+---
+ setup.cfg | 2 +-
+ src/pytest_cython/plugin.py | 4 ++--
+ tests/example-project/setup.py | 7 ++++---
+ tests/example-project/src/__init__.py | 0
+ tests/test_pytest_cython.py | 16 ++++++++--------
+ 5 files changed, 15 insertions(+), 14 deletions(-)
+ create mode 100644 tests/example-project/src/__init__.py
+
+diff --git a/setup.cfg b/setup.cfg
+index a5f7bb1..1b8c2c3 100644
+--- a/setup.cfg
++++ b/setup.cfg
+@@ -8,7 +8,7 @@ release = register clean --all sdist bdist_wheel
+ max-line-length = 140
+ exclude = tests/*,*/migrations/*,*/south_migrations/*
+
+-[pytest]
++[tool:pytest]
+ norecursedirs =
+ .git
+ .tox
+diff --git a/src/pytest_cython/plugin.py b/src/pytest_cython/plugin.py
+index d4874cd..5c610e4 100644
+--- a/src/pytest_cython/plugin.py
++++ b/src/pytest_cython/plugin.py
+@@ -67,7 +67,7 @@ def pytest_collect_file(path, parent):
+ # only run test if matching .so and .pyx files exist
+ # create addoption for this ??
+ if pyx_file is not None:
+- return DoctestModule(path, parent)
++ return DoctestModule.from_parent(parent, fspath=path)
+
+
+ # XXX patch pyimport to support PEP 3149
+@@ -117,7 +117,7 @@ def collect(self):
+ checker=checker)
+ for test in finder.find(module, module.__name__):
+ if test.examples: # skip empty doctests
+- yield DoctestItem(test.name, self, runner, test)
++ yield DoctestItem.from_parent(self, name=test.name, runner=runner, dtest=test)
+
+ def _importtestmodule(self):
+ # we assume we are only called once per module
+diff --git a/tests/example-project/setup.py b/tests/example-project/setup.py
+index fca0567..e690383 100644
+--- a/tests/example-project/setup.py
++++ b/tests/example-project/setup.py
+@@ -55,11 +55,12 @@
+ exclude_files = ['__init__.py']
+ include_dirs = [os.path.abspath(os.path.join(root, 'src/clib'))]
+ for file_ in ext_files:
+- if os.path.basename(file_) in exclude_files:
++ basename = os.path.basename(file_)
++ if basename in exclude_files:
+ continue
+- pyx_file, _ = os.path.splitext(file_)
++ pyx_file, _ = os.path.splitext(basename)
+ extensions.append(Extension(
+- pyx_file,
++ 'src.pypackage.' + pyx_file,
+ [file_],
+ define_macros=macros,
+ include_dirs=include_dirs,
+diff --git a/tests/example-project/src/__init__.py b/tests/example-project/src/__init__.py
+new file mode 100644
+index 0000000..e69de29
+diff --git a/tests/test_pytest_cython.py b/tests/test_pytest_cython.py
+index 55a66bf..e546fe3 100644
+--- a/tests/test_pytest_cython.py
++++ b/tests/test_pytest_cython.py
+@@ -15,9 +15,9 @@ def test_cython_ext_module(testdir):
+ assert module.check()
+ result = testdir.runpytest('-vv', '--doctest-cython', str(module))
+ result.stdout.fnmatch_lines([
+- "*Eggs.__init__ *PASSED",
+- "*Eggs.blarg*PASSED",
+- "*Eggs.fubar*PASSED",
++ "*Eggs.__init__ *PASSED*",
++ "*Eggs.blarg*PASSED*",
++ "*Eggs.fubar*PASSED*",
+ ])
+ assert result.ret == 0
+
+@@ -27,7 +27,7 @@ def test_wrap_c_ext_module(testdir):
+ assert module.check()
+ result = testdir.runpytest('-vv', '--doctest-cython', str(module))
+ result.stdout.fnmatch_lines([
+- "*sqr*PASSED",
++ "*sqr*PASSED*",
+ ])
+ assert result.ret == 0
+
+@@ -37,7 +37,7 @@ def test_wrap_cpp_ext_module(testdir):
+ assert module.check()
+ result = testdir.runpytest('-vv', '--doctest-cython', str(module))
+ result.stdout.fnmatch_lines([
+- "*sqr*PASSED",
++ "*sqr*PASSED*",
+ ])
+ assert result.ret == 0
+
+@@ -47,8 +47,8 @@ def test_pure_py_module(testdir):
+ assert module.check()
+ result = testdir.runpytest('-vv', '--doctest-cython', str(module))
+ result.stdout.fnmatch_lines([
+- "*Eggs.__init__*PASSED",
+- "*Eggs.foo*PASSED",
+- "*foo*PASSED",
++ "*Eggs.__init__*PASSED*",
++ "*Eggs.foo*PASSED*",
++ "*foo*PASSED*",
+ ])
+ assert result.ret == 0