pytest/4914.patch

43 lines
1.4 KiB
Diff
Raw Normal View History

From d32ab6029feb178df664e0d347e234cc4480eb7d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Tue, 12 Mar 2019 16:28:10 +0100
Subject: [PATCH] Fix pytest tests invocation with custom PYTHONPATH
Fixes https://github.com/pytest-dev/pytest/issues/4913
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
---
changelog/4913.trivial.rst | 1 +
testing/test_collection.py | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
create mode 100644 changelog/4913.trivial.rst
diff --git a/changelog/4913.trivial.rst b/changelog/4913.trivial.rst
new file mode 100644
index 000000000..7846775cc
--- /dev/null
+++ b/changelog/4913.trivial.rst
@@ -0,0 +1 @@
+Fix pytest tests invocation with custom ``PYTHONPATH``.
diff --git a/testing/test_collection.py b/testing/test_collection.py
index 97c46d8c2..37f7ad89c 100644
--- a/testing/test_collection.py
+++ b/testing/test_collection.py
@@ -2,6 +2,7 @@
from __future__ import division
from __future__ import print_function
+import os
import pprint
import sys
import textwrap
@@ -1108,7 +1109,7 @@ def test_collect_pyargs_with_testpaths(testdir, monkeypatch):
"""
)
)
- monkeypatch.setenv("PYTHONPATH", str(testdir.tmpdir))
+ monkeypatch.setenv("PYTHONPATH", str(testdir.tmpdir), prepend=os.pathsep)
with root.as_cwd():
result = testdir.runpytest_subprocess()
result.stdout.fnmatch_lines(["*1 passed in*"])