From eaa9b045e2debba0df4813d8ec31f31333b4c0a0 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Tue, 20 Sep 2022 23:33:32 -0500 Subject: [PATCH 1/2] test: Disocver pytest fixtures during doctest * Symlink the tests/conftest.py under the src tree to allow for the autouse pytest fixtures to be discovered and used during doctest. This is needed as the backends are not currently being automatically reset between doctests and the fixtures will not be discovered during doctest runs invoked with `pytest src/` as noted in the pytest docs: > Note that like the normal conftest.py, the fixtures are discovered in the > directory tree conftest is in. Meaning that if you put your doctest with > your source code, the relevant conftest.py needs to be in the same directory > tree. Fixtures will not be discovered in a sibling directory tree! - c.f. https://docs.pytest.org/en/7.1.x/how-to/doctest.html#doctest-namespace-fixture * Exclude src/conftest.py from the MANIFEST.in so as to not include it in the sdist build. --- MANIFEST.in | 1 + src/conftest.py | 1 + 2 files changed, 2 insertions(+) create mode 120000 src/conftest.py diff --git a/MANIFEST.in b/MANIFEST.in index 18353aadb6..9a5cfc4150 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,6 @@ prune ** graft src +exlucde src/conftest.py include setup.py include setup.cfg diff --git a/src/conftest.py b/src/conftest.py new file mode 120000 index 0000000000..3e21d51c82 --- /dev/null +++ b/src/conftest.py @@ -0,0 +1 @@ +../tests/conftest.py \ No newline at end of file From 6b64e899a7c6eb5f85447002a5bce7eba2f699b3 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Wed, 21 Sep 2022 00:09:23 -0500 Subject: [PATCH 2/2] fix typo --- MANIFEST.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index 9a5cfc4150..e5af33dbdc 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,6 @@ prune ** graft src -exlucde src/conftest.py +exclude src/conftest.py include setup.py include setup.cfg