Skip to content

pytester: use temporary HOME with spawn #5306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 30, 2019

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented May 24, 2019

Followup to #4956.

@blueyed blueyed force-pushed the spawn-home branch 3 times, most recently from 8a41b82 to 5e5e2f3 Compare May 24, 2019 15:39
@blueyed
Copy link
Contributor Author

blueyed commented May 24, 2019

Refactored it, which also allows for adjusting it via testdir._env_run_update.

@blueyed
Copy link
Contributor Author

blueyed commented May 24, 2019

This would allow for the following now, which works around pdb++ hijacking pdb and adding source code highlighting, which fails some (3) tests currently. Not sure if it should be added though, given that it is rather specific (pdbpp being installed), and tests could be adjusted to cope with it (i.e. loser/other assertions).

diff --git i/testing/test_pdb.py w/testing/test_pdb.py
index c0ba7159b..81e455b13 100644
--- i/testing/test_pdb.py
+++ w/testing/test_pdb.py
@@ -76,6 +76,13 @@ def set_trace(self, frame):
     del _pytest._CustomDebugger


+@pytest.fixture(autouse=True)
+def pdb_env(request):
+    if "testdir" in request.funcargnames:
+        testdir = request.getfixturevalue("testdir")
+        testdir._env_run_update["PDBPP_HIJACK_PDB"] = "0"
+
+
 class TestPDB(object):
     @pytest.fixture
     def pdblist(self, request):

@blueyed
Copy link
Contributor Author

blueyed commented May 24, 2019

Note that the above fixture is different from setting PDBPP_HIJACK_PDB=0 before running pytest: it would still use pdbpp then in the outer tests.

@nicoddemus
Copy link
Member

This would allow for the following now, which works around pdb++ hijacking pdb and adding source code highlighting, which fails some (3) tests currently. Not sure if it should be added though, given that it is rather specific (pdbpp being installed), and tests could be adjusted to cope with it (i.e. loser/other assertions).

I'm fine if this helps people with pdb++ installed to run the pytest suite (such as yourself), just please make sure to add an informative docstring to the fixture though.

Also feel free to merge this now if you prefer to introduce this fixture in a future PR instead.

@blueyed blueyed closed this May 26, 2019
@blueyed blueyed reopened this May 26, 2019
blueyed added a commit to blueyed/pytest that referenced this pull request May 27, 2019
For pytest-dev#5306 I would have to add
`testing/test_pytester.py` to the default pos args, but that would run
all other tests therein additionally.

This also adds pexpect tests to the MacOS job, which appears to have
caused trouble at least in the past, and likely needs fixing here before
this works.
@blueyed blueyed changed the title pytester: use temporary HOME with spawn [WIP] pytester: use temporary HOME with spawn May 27, 2019
@blueyed
Copy link
Contributor Author

blueyed commented May 27, 2019

Test was skipped - needs #5313.

blueyed added a commit to blueyed/pytest that referenced this pull request May 27, 2019
For pytest-dev#5306 I would have to add
`testing/test_pytester.py` to the default pos args, but that would run
all other tests therein additionally.

This also adds pexpect tests to the MacOS job, which appears to have
caused trouble at least in the past, and likely needs fixing here before
this works.
blueyed added a commit to blueyed/pytest that referenced this pull request May 27, 2019
For pytest-dev#5306 I would have to add
`testing/test_pytester.py` to the default pos args, but that would run
all other tests therein additionally.

This also adds pexpect tests to the MacOS job, which appears to have
caused trouble at least in the past, and likely needs fixing here before
this works.
@blueyed blueyed changed the title [WIP] pytester: use temporary HOME with spawn pytester: use temporary HOME with spawn May 30, 2019
@blueyed blueyed changed the title pytester: use temporary HOME with spawn [WIP] pytester: use temporary HOME with spawn May 30, 2019
@blueyed blueyed changed the title [WIP] pytester: use temporary HOME with spawn pytester: use temporary HOME with spawn May 30, 2019
@blueyed blueyed merged commit 882f3a4 into pytest-dev:features May 30, 2019
@blueyed blueyed deleted the spawn-home branch May 30, 2019 18:46
blueyed added a commit to blueyed/pytest that referenced this pull request Oct 18, 2019
@pytest-dev pytest-dev deleted a comment from codecov bot Nov 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants