Skip to content

Commit 1c74a51

Browse files
authored
Ensure native strings in environ (#1314)
1 parent f0808f7 commit 1c74a51

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

docs/changelog/1313.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Ensure ``TOX_WORK_DIR`` is a native string in ``os.environ`` - by :user:`asottile`.

src/tox/session/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def main(args):
6363
try:
6464
config = load_config(args)
6565
config.logdir.ensure(dir=1)
66-
with set_os_env_var("TOX_WORK_DIR", config.toxworkdir):
66+
with set_os_env_var(str("TOX_WORK_DIR"), config.toxworkdir):
6767
session = build_session(config)
6868
exit_code = session.runcommand()
6969
if exit_code is None:

tests/unit/session/test_session.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,10 @@ def assert_popen_env(res):
285285
if tox_id != "GLOB":
286286
assert env["TOX_ENV_NAME"] == tox_id
287287
assert env["TOX_ENV_DIR"] == os.path.join(res.cwd, ".tox", tox_id)
288+
# ensure native strings for environ for windows
289+
for k, v in env.items():
290+
assert type(k) is str, (k, v, type(k))
291+
assert type(v) is str, (k, v, type(v))
288292

289293

290294
def test_command_prev_post_ok(cmd, initproj, mock_venv):

0 commit comments

Comments
 (0)