Skip to content

Conversation

asottile
Copy link
Contributor

No description provided.

@asottile
Copy link
Contributor Author

I still need to actually check this on windows -- but I think this fixes it :)

@asottile
Copy link
Contributor Author

can confirm this fixes things, however it's insufficient to get tox working on python2.7 on windows:

#1315

@asottile
Copy link
Contributor Author

@gaborbernat it looks like azure pipelines isn't actually testing python2.7 🙃

@asottile asottile merged commit 1c74a51 into tox-dev:master May 23, 2019
@asottile asottile deleted the strings_in_env branch May 23, 2019 16:43
@gaborbernat
Copy link
Member

what 😮

py27 installed: apipkg==1.5,atomicwrites==1.3.0,attrs==19.1.0,colorama==0.4.1,coverage==4.5.3,execnet==1.6.0,filelock==3.0.12,flaky==3.5.3,freezegun==0.3.11,more-itertools==7.0.0,pathlib2==2.3.3,pluggy==0.11.0,psutil==5.6.2,py==1.8.0,pytest==4.5.0,pytest-cov==2.7.1,pytest-forked==1.0.2,pytest-mock==1.10.4,pytest-randomly==1.2.3,pytest-xdist==1.28.0,python-dateutil==2.8.0,six==1.12.0,toml==0.10.0,tox==3.12.1.dev1+gf0808f7,virtualenv==16.6.0,wcwidth==0.1.7
py27 run-test-pre: PYTHONHASHSEED='879'
py27 run-test: commands[0] | pytest --cov 'D:\a\1\s\.tox\py27\Lib\site-packages/tox' --cov-config 'D:\a\1\s/tox.ini' --junitxml 'D:\a\1\s\.tox/junit.py27.xml' -n=auto .
============================= test session starts =============================
platform win32 -- Python 3.7.2, pytest-4.5.0, py-1.8.0, pluggy-0.11.0 -- d:\a\1\s\.tox\py27\scripts\python.exe
cachedir: .tox\py27\.pytest_cache

what's this magic 🤔

assert env["TOX_ENV_DIR"] == os.path.join(res.cwd, ".tox", tox_id)
# ensure native strings for environ for windows
for k, v in env.items():
assert type(k) is str, (k, v, type(k))
Copy link

@luzfcb luzfcb May 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asottile
A technical question: Why not use isinstance(k, str) instead of type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type(...) is a stronger assertion here than isinstance -- I'm guarding against subclasses of str

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks to the explanation.

In [1]: class foostr(str):
   ...:     pass
   ...:
   ...:

In [2]: x = str("bar")

In [3]: y = foostr("bar")

In [4]: type(x)
Out[4]: str

In [5]: type(y)
Out[5]: __main__.foostr

In [6]: isinstance(x, str)
Out[6]: True

In [7]: isinstance(y, str)
Out[7]: True

In [8]: type(x) is str
Out[8]: True

In [9]: type(y) is str
Out[9]: False

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.

3 participants