here is the part of the files that are important for this question:
.
├── .env
├── tox.ini
├── requirements-dev.txt
└── tests/
├── test_blocking.py
└── test_async.py
.env example
token = # Replace this with your API token
base_url = # Proxy server to handle requests to API due to IP limitations
tox.ini
[tox]
envlist = py35,py36,py37,py38
[testenv]
changedir = tests
deps = -r{toxinidir}/requirements-dev.txt
sitepackages = true
whitelist_externals =
flake8
pytest
commands =
flake8
pytest
passenv =
token
base_url
[flake8]
max-line-length=120
exclude = __init__.py,.tox
ignore = E252,E302,E731,W605
requirements-dev.txt
asynctest
flake8
pluggy>=0.12.0,<1.0.0
pytest
pytest-asyncio
python-dotenv
tox-travis
with files from tests/ everything is OK, they work on other versions
if, from the project's home directory, in cmd I run such a command tox -e py38
I get this output:
GLOB sdist-make: C:\Python\projects\brawlstats\setup.py
py38 inst-nodeps: C:\Python\projects\brawlstats\.tox\.tmp\package\1\brawlstats-4.0.3.zip
py38 installed: absl-py==0.9.0,aiohttp==3.6.2,alabaster==0.7.12,altgraph==0.17,apng==0.3.4,appdirs==1.4.3,argh==0.26.2,asgiref==3.2.3,astroid==2.3.3,astunparse==1.6.3,async-timeout==3.0.1,asynctest==0.13.0,atomicwrites==1.3.0,attrs==19.3.0,audio2numpy==0.1.2,autopep8==1.5.1,Babel==2.8.0,backcall==0.1.0,bandit==1.6.2,beautifulsoup4==4.9.0,bleach==3.1.4,blis==0.4.1,brawlstats==4.0.3,bs4==0.0.1,cachetools==4.0.0,catalogue==1.0.0,certifi==2019.11.28,cfgv==3.1.0,chardet==3.0.4,click==7.1.1,colorama==0.4.1,colorlog==4.1.0,colour==0.1.5,cPython==0.0.5,cycler==0.10.0,cymem==2.0.3,decorator==4.4.1,defusedxml==0.6.0,distlib==0.3.0,Django==3.0.3,dnspython==1.16.0,docutils==0.16,dodgy==0.2.1,EasyProcess==0.2.10,entrypoint2==0.2,entrypoints==0.3,eventlet==0.25.2,fbs==0.8.6,feedparser==5.2.1,ffmpeg==1.4,filelock==3.0.12,flake8==3.8.3,flake8-polyfill==1.0.2,future==0.18.2,futures==3.1.1,gast==0.3.3,gitdb2==2.0.6,GitPython==2.1.15,google-api-core==1.16.0,google-api-python-client==1.8.2,google-auth==1.11.3,google-auth-httplib2==0.0.3,google-auth-oauthlib==0.4.1,google-cloud-core==1.3.0,google-cloud-translate==2.0.1,google-pasta==0.2.0,googleapis-common-protos==1.51.0,googletrans==2.4.0,goslate==1.5.1,greenlet==0.4.16,grpcio==1.27.2,h5py==2.10.0,httplib2==0.15.0,identify==1.4.11,idna==2.9,imagesize==1.2.0,ipykernel==5.2.1,ipython==7.13.0,ipython-genutils==0.2.0,isort==4.3.21,jedi==0.17.0,Jinja2==2.11.2,json5==0.9.4,jsonschema==3.2.0,jupyter-client==6.1.3,jupyter-core==4.6.3,jupyterlab==2.1.1,jupyterlab-server==1.1.1,Keras-Preprocessing==1.1.2,kivy-deps.angle==0.1.10,kivy-deps.glew==0.1.12,kivy-deps.gstreamer==0.1.18,kivy-deps.sdl2==0.1.23,Kivy-Garden==0.1.4,kiwisolver==1.1.0,lazy-object-proxy==1.4.3,livereload==2.6.2,llvmlite==0.33.0,lxml==4.5.0,macholib==1.14,mando==0.6.4,Markdown==3.2.2,MarkupSafe==1.1.1,matplotlib==3.1.3,mccabe==0.6.1,mistune==0.8.4,monotonic==1.5,more-itertools==8.2.0,mss==5.0.0,multidict==4.7.5,murmurhash==1.0.2,mypy==0.782,mypy-extensions==0.4.3,nbconvert==5.6.1,nbformat==4.4.0,networkx==2.4,nodeenv==1.3.5,notebook==6.0.3,Nuitka==0.6.8.4,numba==0.50.0,numpy==1.18.1,oauth2client==4.1.3,oauthlib==3.1.0,opencv-python==4.2.0.32,opt-einsum==3.2.1,packaging==20.3,pandas==1.0.3,pandocfilters==1.4.2,parso==0.7.0,pathtools==0.1.2,pbr==5.4.5,pefile==2019.4.18,pep8==1.7.1,pep8-naming==0.4.1,pickleshare==0.7.5,Pillow==7.0.0,plac==1.1.3,plotly==4.8.0,pluggy==0.13.1,port-for==0.3.1,pre-commit==2.2.0,preshed==3.0.2,progress==1.4,prometheus-client==0.7.1,prompt-toolkit==3.0.5,prospector==1.2.0,protobuf==3.11.3,py==1.8.1,pyasn1==0.4.8,pyasn1-modules==0.2.8,pycodestyle==2.6.0,pydocstyle==5.0.2,PyDrive==1.3.1,pydub==0.23.1,pyflakes==2.2.0,pygame==1.9.6,pyglet==1.5.2,Pygments==2.6.1,PyInstaller==3.4,pylama==7.7.1,pylint==2.4.4,pylint-celery==0.3,pylint-django==2.0.12,pylint-flask==0.6,pylint-plugin-utils==0.6,pymongo==3.10.1,pynput==1.6.6,pyparsing==2.4.6,pypiwin32==223,PyQt-builder==1.2.0,PyQt5==5.13.2,PyQt5-sip==12.7.1,pyqt5-tools==5.13.2.1.6rc1,pyrsistent==0.16.0,pyscreenshot==1.0,PySimpleGUI==4.18.0,pytest==5.4.1,pytest-asyncio==0.14.0,python-box==4.2.2,python-dateutil==2.8.1,python-dotenv==0.12.0,python-statemachine==0.8.0,pytz==2019.3,pywin32==227,pywin32-ctypes==0.2.0,pywinpty==0.5.7,PyYAML==5.3,pyzmq==19.0.0,qimage2ndarray==1.8.3,radon==4.0.0,requests==2.23.0,requests-oauthlib==1.3.0,requirements-detector==0.7,retrying==1.3.3,rope==0.16.0,rsa==4.0,rstcheck==3.3.1,ruamel.yaml==0.16.10,ruamel.yaml.clib==0.2.0,scipy==1.4.1,selenium==3.141.0,Send2Trash==1.5.0,setoptconf==0.2.0,simpleaudio==1.0.4,sip==5.1.1,six==1.14.0,smmap==3.0.4,smmap2==3.0.1,snowballstemmer==2.0.0,soupsieve==2.0,spacy==2.2.4,Sphinx==3.1.1,sphinx-autobuild==0.7.1,sphinxcontrib-applehelp==1.0.2,sphinxcontrib-devhelp==1.0.2,sphinxcontrib-htmlhelp==1.0.3,sphinxcontrib-jsmath==1.0.1,sphinxcontrib-qthelp==1.0.3,sphinxcontrib-serializinghtml==1.1.4,sqlparse==0.3.0,srsly==1.0.2,stevedore==2.0.1,tabulate==0.8.7,tensorboard==2.2.1,tensorboard-plugin-wit==1.6.0.post3,tensorflow==2.2.0,tensorflow-estimator==2.2.0,tensorflow-hub==0.8.0,termcolor==1.1.0,terminado==0.8.3,testpath==0.4.4,thinc==7.4.0,tkcalendar==1.6.1,toml==0.10.0,tornado==6.0.4,tox==3.14.5,tox-travis==0.12,tqdm==4.46.0,traitlets==4.3.3,translate==3.5.0,typed-ast==1.4.1,typing-extensions==3.7.4.2,uritemplate==3.0.1,urllib3==1.25.8,virtualenv==20.0.15,vk-api==11.8.0,wasabi==0.6.0,watchdog==0.10.3,wcwidth==0.1.9,webencodings==0.5.1,Werkzeug==1.0.1,wily==1.16.0,wrapt==1.11.2,wxPython==4.0.7.post2,yarl==1.4.2
py38 run-test-pre: PYTHONHASHSEED='87'
py38 run-test: commands[0] | flake8
Traceback (most recent call last):
File "c:\program files\python38\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\program files\python38\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\ASUS\AppData\Roaming\Python\Python38\Scripts\flake8.EXE\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'flake8'
ERROR: InvocationError for command 'C:\Users\ASUS\AppData\Roaming\Python\Python38\Scripts\flake8.EXE' (exited with code 1)
_________________________________________________________________________________ summary _________________________________________________________________________________
ERROR: py38: commands failed
also if i run pip3.8 show flake8
I get this output:
Name: flake8
Version: 3.8.3
Summary: the modular source code checker: pep8 pyflakes and co
Home-page: https://gitlab.com/pycqa/flake8
Author: Tarek Ziade
Author-email: tarek@ziade.org
License: MIT
Location: c:\users\asus\appdata\roaming\python\python38\site-packages
Requires: pycodestyle, mccabe, pyflakes
Required-by: flake8-polyfill
what am I doing wrong? on py 3.7 everything works fine. maybe my tox is bad? what should I do? please, help!
My compliments on such an extensive report. Your issue lies probably in this weird setup you've got going on.
# This alows for packages to be accessed from the **globally** installed Python (NOT the tox env).
sitepackages = True
# This alows for commands to be used available outside tox. Typically used for non-python callables.
whitelist_externals =
flake8
pytest
# Redundant || the context change is confusing - try to use everything from the project root.
changedir = tests
So in short you're not using the tox
dependencies. You're trying to use global packages and not the ones that tox
installed. This, some conjecture, probably lead to some import conflict in python 3.8 globally available packages.
Try the following:
[tox]
envlist = py35,py36,py37,py38
[testenv]
deps = -r{toxinidir}/requirements-dev.txt
commands =
flake8 {{folders}}
pytest
passenv =
token
base_url
[flake8]
max-line-length=120
exclude = __init__.py
ignore = E252,E302,E731,W605
PS. Replace {{folders}} with whatever your directory(ies) off code are, usually easier than excluding all kinds of dirs (that might be autogenerated in the future). I typically have flake8 src tests
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.