Skip to content
This repository was archived by the owner on May 29, 2024. It is now read-only.

Commit 743bde8

Browse files
authored
Update the environ shim to be compatible with Python 3.9 (#98)
* Tests incompatible with latest pytest * Update environ shim to be compatible with Python 3.9 The `os.putenv()` and `os.unsetenv()` are always available starting in Python 3.9, removing the need for special handling in the `os._Environ` mapping: python/cpython@b8d1262 Update the environ shim to match.
1 parent 388e194 commit 743bde8

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

pytest_parallel/__init__.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,26 @@ def pytest_configure(config):
113113

114114
class ThreadLocalEnviron(os._Environ):
115115
def __init__(self, env):
116-
super().__init__(
117-
env._data,
118-
env.encodekey,
119-
env.decodekey,
120-
env.encodevalue,
121-
env.decodevalue,
122-
env.putenv,
123-
env.unsetenv
124-
)
116+
if sys.version_info >= (3, 9):
117+
super().__init__(
118+
env._data,
119+
env.encodekey,
120+
env.decodekey,
121+
env.encodevalue,
122+
env.decodevalue,
123+
)
124+
self.putenv = os.putenv
125+
self.unsetenv = os.unsetenv
126+
else:
127+
super().__init__(
128+
env._data,
129+
env.encodekey,
130+
env.decodekey,
131+
env.encodevalue,
132+
env.decodevalue,
133+
env.putenv,
134+
env.unsetenv
135+
)
125136
if hasattr(env, 'thread_store'):
126137
self.thread_store = env.thread_store
127138
else:

tests/test_general.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ def test_async_2():
6969

7070

7171
@pytest.mark.parametrize('cli_args', [
72-
[],
7372
['--workers=2'],
7473
['--tests-per-worker=2']
7574
])

tox.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ envlist =
44
py36
55
py37
66
py38
7+
py39
78

89
[testenv]
910
deps =
10-
pytest>=3.0
11+
pytest>=3.0,<6.0
1112
pytest-html>=1.19.0
1213
six>=1.11.0
1314
tblib

0 commit comments

Comments
 (0)