Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Tox“;错误:找不到文件:<;项目名称>&引用;_Python_Macos_Pytest_Tox - Fatal编程技术网

Python Tox“;错误:找不到文件:<;项目名称>&引用;

Python Tox“;错误:找不到文件:<;项目名称>&引用;,python,macos,pytest,tox,Python,Macos,Pytest,Tox,我正在运行一个基于tox的超级简单的tox.ini文件和一个名为。问题是每次我运行tox命令时,都会出现一系列调用错误和“ERROR:file not found: tox.ini: CLI: 在此期间,tox.ini设置中的第一行项目之一是写入与跳过创建sdist有关的行,这被认为是“昂贵的”: 如果您的测试依赖于导入您的包,那么这是非常重要的一步(提示:他们几乎必须这样做。否则,他们测试的是什么?)。视频的讲述者(也是项目的主要贡献者)确实提到以“开发”模式安装包(pip install-e

我正在运行一个基于tox的超级简单的
tox.ini
文件和一个名为。问题是每次我运行
tox
命令时,都会出现一系列调用错误和“ERROR:file not found:
tox.ini
: CLI: 在此期间,
tox.ini
设置中的第一行项目之一是写入与跳过创建
sdist
有关的行,这被认为是“昂贵的”:

如果您的测试依赖于导入您的包,那么这是非常重要的一步(提示:他们几乎必须这样做。否则,他们测试的是什么?)。视频的讲述者(也是项目的主要贡献者)确实提到以“开发”模式安装包(
pip install-e.
),但忽略了提及(或者我听错了)包确实需要在某个时候安装

将此值更改为
skipsdist=false
或简单地删除该行即可完全修复此问题

# tox (https://tox.readthedocs.io/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.

[tox]
skipsdist = true
envlist = py36, py37, build
skip_missing_interpreters = true

[testenv]
whitelist_externals = *
passenv = *
deps = -rrequirements-test.txt
commands = {[testenv:unit]commands}

[travis]
python =
    3.6: py36
    3.7: py37, build

[testenv:unit]
deps = {[testenv]deps}
commands = pytest {posargs:--cov={envsitepackagesdir}/project_name {envsitepackagesdir}/project_name src/tests}

[testenv:test]
deps =
    {[testenv]deps}
    {[testenv:build]deps}
commands =
    {[testenv:unit]commands}
    {[testenv:build]commands}

[testenv:build]
skip_install = true
deps =
    wheel
commands =
    rm -rf dist build
    python -W ignore setup.py -q sdist bdist_wheel

;[testenv:release]
;deps =
;    {[testenv:build]deps}
;    twine
;commands =
;    {[testenv:build]commands}
;    twine upload dist/*
;

# From https://pytest-cov.readthedocs.io/en/latest/tox.html
[testenv:clean]
deps = coverage
skip_install = true
commands = coverage erase

[pytest]
addopts =
    -v -s
    --color=yes
    --cov
    --cov-append
    --cov-report=term-missing
    --cov-config=setup.cfg

[coverage:run]
omit =
    */tests/*
    */test_*
    */distutils/*
    */site-packages/*

[coverage:report]
show_missing = True

[flake8]
exclude = .tox

[report]
omit = */usr/*
$ tox
py36 create: /path/to/my/project/python/project_namepy/.tox/py36
py36 installdeps: -rrequirements-test.txt
py36 installed: atomicwrites==1.3.0,attrs==19.1.0,bleach==3.1.0,certifi==2019.6.16,chardet==3.0.4,colorama==0.4.1,coverage==4.5.4,docutils==0.15.2,Faker==2.0.0,filelock==3.0.12,idna==2.8,importlib-metadata==0.19,more-itertools==7.2.0,packaging==19.1,pkginfo==1.5.0.1,pluggy==0.12.0,py==1.8.0,Pygments==2.4.2,pyparsing==2.4.2,pytest==5.0.1,pytest-cov==2.7.1,python-dateutil==2.8.0,readme-renderer==24.0,requests==2.22.0,requests-toolbelt==0.9.1,six==1.12.0,text-unidecode==1.2,toml==0.10.0,tox==3.13.2,tqdm==4.33.0,twine==1.13.0,urllib3==1.25.3,virtualenv==16.7.2,wcwidth==0.1.7,webencodings==0.5.1,zipp==0.5.2
py36 run-test-pre: PYTHONHASHSEED='2972258678'
py36 run-test: commands[0] | pytest --cov=/path/to/my/project/python/project_namepy/.tox/py36/lib/python3.6/site-packages/project_name /path/to/my/project/python/project_namepy/.tox/py36/lib/python3.6/site-packages/project_name src/tests
==================================================================================== test session starts ====================================================================================
platform darwin -- Python 3.6.5, pytest-5.0.1, py-1.8.0, pluggy-0.12.0 -- /usr/local/Cellar/python/3.6.5/bin/python3.6
cachedir: .tox/py36/.pytest_cache
rootdir: /path/to/my/project/python/project_namepy, inifile: tox.ini
plugins: cov-2.7.1
collected 0 items                                                                                                                                                                           

=============================================================================== no tests ran in 0.02 seconds ================================================================================
ERROR: file not found: /path/to/my/project/python/project_namepy/.tox/py36/lib/python3.6/site-packages/project_name

ERROR: InvocationError for command /path/to/my/project/python/project_namepy/.tox/py36/bin/pytest --cov=/path/to/my/project/python/project_namepy/.tox/py36/lib/python3.6/site-packages/project_name /path/to/my/project/python/project_namepy/.tox/py36/lib/python3.6/site-packages/project_name src/tests (exited with code 4)
py37 create: /path/to/my/project/python/project_namepy/.tox/py37
py37 installdeps: -rrequirements-test.txt
py37 installed: atomicwrites==1.3.0,attrs==19.1.0,bleach==3.1.0,certifi==2019.6.16,chardet==3.0.4,colorama==0.4.1,coverage==4.5.4,docutils==0.15.2,Faker==2.0.0,filelock==3.0.12,idna==2.8,importlib-metadata==0.19,more-itertools==7.2.0,packaging==19.1,pkginfo==1.5.0.1,pluggy==0.12.0,py==1.8.0,Pygments==2.4.2,pyparsing==2.4.2,pytest==5.0.1,pytest-cov==2.7.1,python-dateutil==2.8.0,readme-renderer==24.0,requests==2.22.0,requests-toolbelt==0.9.1,six==1.12.0,text-unidecode==1.2,toml==0.10.0,tox==3.13.2,tqdm==4.33.0,twine==1.13.0,urllib3==1.25.3,virtualenv==16.7.2,wcwidth==0.1.7,webencodings==0.5.1,zipp==0.5.2
py37 run-test-pre: PYTHONHASHSEED='2972258678'
py37 run-test: commands[0] | pytest --cov=/path/to/my/project/python/project_namepy/.tox/py37/lib/python3.7/site-packages/project_name /path/to/my/project/python/project_namepy/.tox/py37/lib/python3.7/site-packages/project_name src/tests
==================================================================================== test session starts ====================================================================================
platform darwin -- Python 3.7.4, pytest-5.0.1, py-1.8.0, pluggy-0.12.0 -- /usr/local/Cellar/python/3.6.5/bin/python3.6
cachedir: .tox/py37/.pytest_cache
rootdir: /path/to/my/project/python/project_namepy, inifile: tox.ini
plugins: cov-2.7.1
collected 0 items                                                                                                                                                                           

=============================================================================== no tests ran in 0.01 seconds ================================================================================
ERROR: file not found: /path/to/my/project/python/project_namepy/.tox/py37/lib/python3.7/site-packages/project_name

ERROR: InvocationError for command /path/to/my/project/python/project_namepy/.tox/py37/bin/pytest --cov=/path/to/my/project/python/project_namepy/.tox/py37/lib/python3.7/site-packages/project_name /path/to/my/project/python/project_namepy/.tox/py37/lib/python3.7/site-packages/project_name src/tests (exited with code 4)
build create: /path/to/my/project/python/project_namepy/.tox/build
build installdeps: wheel
build run-test-pre: PYTHONHASHSEED='2972258678'
build run-test: commands[0] | rm -rf dist build
build run-test: commands[1] | python -W ignore setup.py -q sdist bdist_wheel
__________________________________________________________________________________________ summary __________________________________________________________________________________________
ERROR:   py36: commands failed
ERROR:   py37: commands failed
  build: commands succeeded
[tox]
skipsdist = true