attrs/tox.ini

130 lines
2.9 KiB
INI
Raw Normal View History

2019-10-17 10:46:22 +00:00
[pytest]
addopts = -ra
testpaths = tests
xfail_strict = true
2019-10-17 10:46:22 +00:00
filterwarnings =
once::Warning
ignore:::pympler[.*]
# Keep docs in sync with docs env and .readthedocs.yml.
[gh-actions]
python =
2.7: py27
3.5: py35
3.6: py36
3.7: py37
2021-11-29 08:03:39 +00:00
3.8: py38, changelog
3.9: py39, pyright
2021-11-29 08:03:39 +00:00
3.10: py310, manifest, typing, docs
pypy-2: pypy
pypy-3: pypy3
2015-01-27 16:53:17 +00:00
[tox]
envlist = typing,pre-commit,py27,py35,py36,py37,py38,py39,py310,pypy,pypy3,pyright,manifest,docs,pypi-description,changelog,coverage-report
isolated_build = True
2015-12-08 14:47:03 +00:00
2015-01-27 16:53:17 +00:00
[testenv:docs]
# Keep basepython in sync with gh-actions and .readthedocs.yml.
2021-11-29 08:03:39 +00:00
basepython = python3.10
extras = docs
commands =
sphinx-build -n -T -W -b html -d {envtmpdir}/doctrees docs docs/_build/html
sphinx-build -n -T -W -b doctest -d {envtmpdir}/doctrees docs docs/_build/html
python -m doctest README.rst
2015-01-27 16:53:17 +00:00
[testenv]
extras = tests
commands = python -m pytest {posargs}
[testenv:py27]
extras = tests
2020-01-08 21:02:39 +00:00
commands = coverage run -m pytest {posargs}
2018-07-05 05:39:16 +00:00
[testenv:py37]
extras = tests
2020-01-08 21:02:39 +00:00
commands = coverage run -m pytest {posargs}
2019-06-04 08:38:57 +00:00
[testenv:py310]
# Python 3.6+ has a number of compile-time warnings on invalid string escapes.
# PYTHONWARNINGS=d and --no-compile below make them visible during the Tox run.
basepython = python3.10
install_command = pip install --no-compile {opts} {packages}
setenv =
PYTHONWARNINGS=d
extras = tests
commands = coverage run -m pytest {posargs}
[testenv:coverage-report]
basepython = python3.10
depends = py27,py37,py310
skip_install = true
deps = coverage[toml]>=5.4
commands =
coverage combine
coverage report
[testenv:pre-commit]
basepython = python3.10
2018-06-10 17:40:07 +00:00
skip_install = true
deps =
pre-commit
2018-06-10 17:40:07 +00:00
passenv = HOMEPATH # needed on Windows
commands =
pre-commit run --all-files
2015-01-27 16:53:17 +00:00
[testenv:manifest]
basepython = python3.10
2015-12-08 14:47:03 +00:00
deps = check-manifest
2015-12-08 15:00:06 +00:00
skip_install = true
2015-12-08 14:47:03 +00:00
commands = check-manifest
[testenv:pypi-description]
basepython = python3.8
2015-12-19 12:04:01 +00:00
skip_install = true
deps =
twine
pip >= 18.0.0
commands =
pip wheel -w {envtmpdir}/build --no-deps .
twine check {envtmpdir}/build/*
2015-12-19 12:04:01 +00:00
2017-08-20 05:58:08 +00:00
[testenv:changelog]
basepython = python3.8
deps = towncrier<21.3
2017-08-20 05:58:08 +00:00
skip_install = true
commands = towncrier --draft
Add PEP484 stubs (#238) * Add PEP484 stubs * Deploy .pyi stubs alongside .py files. This is the recommended approach for 3rd party stubs. See: https://github.com/python/typing/issues/84#issuecomment-317217346 * Add support for the new type argument. * Add tests for stubs and address a few issues. * Improve declaration of private vs public objects in stubs * More stub tests * Separate the stub tests into their own tox env it does not make sense to test the stubs in multiple python *runtime* environments (e.g. python 3.5, 3.6, pypy3) because the results of static analysis wrt attrs is not dependent on the runtime. Moreover, mypy is not installing correctly in pypy3 which has nothing to do with attrs. * Update the manifest with stub files * Remove mypy from the dev requirements * Allow _CountingAttr to be instantiated, but not Attribute. * Incorporate defaults into attr.ib typing * Fix a bug with validators.and_ * Add more tests * Remove _CountingAttr from public interface It is crucial to ensure that make_class() works with attr.ib(), as a result we no longer have any functions that care about _CountingAttr. * Lie about return type of Factory this allows for an abbreviated idiom: `x: List[int] = Factory(list)` * Add tox stubs env to travis * used the wrong comment character in mypy tests * Improve overloads using PyCharm order-based approach overloads are pretty broken in mypy. the best we can do for now is target PyCharm, which is much more forgiving. * Remove features not yet working in mypy. Document remaining issues. * Test stubs against euresti fork of mypy with attrs plugin Copied the pytest plugin from mypy for testing annotations: It is not an officially supported API and using the plugin from mypy could break after any update. * Add some types and TypeVars to some types. Make tests pass * Suppress warnings about named attribute access from fields() e.g. fields(C).x Eventually it would be good to add support for returning NamedTuple from the mypy plugin * Add WIP mypy-doctest plugin * Deal with a few remaining type issues in the docs * sphinx doctest: don't turn warnings into errors. doing so makes the tests abort after the first failed group. * Update "type: ignore" comments to reflect issues fixed in mypy plugin * doctest2: improve output formatting * Update manifest * static tests: use inline error declarations * More tests * Tests passing (with notes about remaining issues) * Attempt to get latest plugin from euresti working * Issues fixed. Had to place calls to attr.ib under a class definition. * Deal with a PyCharm bug * Minor test improvements * Make tests prettier * Use 2 decorators instead of 3 * doctest2: add support for skipping mypy tests * Add tests for inheritance, eq, and cmp * Add fixmes and todos * Rename convert to converter * Attribute.validator is always a single validator * Conform stubs to typeshed coding style And add auto_attrib kw * backport style fixes from typeshed * Add test cases to cover forward references and Any * Add fixes for forward references and Any * Address typeshed review notes * Use Sequence instead of List/Tuple for validator arg list and tuple are invariant and so prevent passing subtypes of _ValidatorType * backports changes from typeshed #1914 * backport changes from typeshed #1933 * Prevent mypy tests from getting picked up Evidently the discovery rules changed recently for pytest. * make our doctest extension compatible with latest sphinx * Adjustments to the tests * Fix flake and manifest tests (hopefully) * Fix tests on pypy3 (hopefully) * Update stubs from typeshed Also update tests. * Make PEP 561-compliant * minor cleanup * Consolidate stub support files into stub directory In preparation for removing them from the pyi_stubs branch. * Get tests passing This is a final test of the current stubs before moving the stub tests to a new branch. * Revert stub test additions Replace with a simple mypy pass/fail test * get pre-commit passing * Address review feedback * Move typing test up in tox envlist
2018-07-12 10:19:24 +00:00
2018-11-26 11:58:39 +00:00
Add PEP484 stubs (#238) * Add PEP484 stubs * Deploy .pyi stubs alongside .py files. This is the recommended approach for 3rd party stubs. See: https://github.com/python/typing/issues/84#issuecomment-317217346 * Add support for the new type argument. * Add tests for stubs and address a few issues. * Improve declaration of private vs public objects in stubs * More stub tests * Separate the stub tests into their own tox env it does not make sense to test the stubs in multiple python *runtime* environments (e.g. python 3.5, 3.6, pypy3) because the results of static analysis wrt attrs is not dependent on the runtime. Moreover, mypy is not installing correctly in pypy3 which has nothing to do with attrs. * Update the manifest with stub files * Remove mypy from the dev requirements * Allow _CountingAttr to be instantiated, but not Attribute. * Incorporate defaults into attr.ib typing * Fix a bug with validators.and_ * Add more tests * Remove _CountingAttr from public interface It is crucial to ensure that make_class() works with attr.ib(), as a result we no longer have any functions that care about _CountingAttr. * Lie about return type of Factory this allows for an abbreviated idiom: `x: List[int] = Factory(list)` * Add tox stubs env to travis * used the wrong comment character in mypy tests * Improve overloads using PyCharm order-based approach overloads are pretty broken in mypy. the best we can do for now is target PyCharm, which is much more forgiving. * Remove features not yet working in mypy. Document remaining issues. * Test stubs against euresti fork of mypy with attrs plugin Copied the pytest plugin from mypy for testing annotations: It is not an officially supported API and using the plugin from mypy could break after any update. * Add some types and TypeVars to some types. Make tests pass * Suppress warnings about named attribute access from fields() e.g. fields(C).x Eventually it would be good to add support for returning NamedTuple from the mypy plugin * Add WIP mypy-doctest plugin * Deal with a few remaining type issues in the docs * sphinx doctest: don't turn warnings into errors. doing so makes the tests abort after the first failed group. * Update "type: ignore" comments to reflect issues fixed in mypy plugin * doctest2: improve output formatting * Update manifest * static tests: use inline error declarations * More tests * Tests passing (with notes about remaining issues) * Attempt to get latest plugin from euresti working * Issues fixed. Had to place calls to attr.ib under a class definition. * Deal with a PyCharm bug * Minor test improvements * Make tests prettier * Use 2 decorators instead of 3 * doctest2: add support for skipping mypy tests * Add tests for inheritance, eq, and cmp * Add fixmes and todos * Rename convert to converter * Attribute.validator is always a single validator * Conform stubs to typeshed coding style And add auto_attrib kw * backport style fixes from typeshed * Add test cases to cover forward references and Any * Add fixes for forward references and Any * Address typeshed review notes * Use Sequence instead of List/Tuple for validator arg list and tuple are invariant and so prevent passing subtypes of _ValidatorType * backports changes from typeshed #1914 * backport changes from typeshed #1933 * Prevent mypy tests from getting picked up Evidently the discovery rules changed recently for pytest. * make our doctest extension compatible with latest sphinx * Adjustments to the tests * Fix flake and manifest tests (hopefully) * Fix tests on pypy3 (hopefully) * Update stubs from typeshed Also update tests. * Make PEP 561-compliant * minor cleanup * Consolidate stub support files into stub directory In preparation for removing them from the pyi_stubs branch. * Get tests passing This is a final test of the current stubs before moving the stub tests to a new branch. * Revert stub test additions Replace with a simple mypy pass/fail test * get pre-commit passing * Address review feedback * Move typing test up in tox envlist
2018-07-12 10:19:24 +00:00
[testenv:typing]
basepython = python3.10
deps = mypy>=0.902
commands =
mypy src/attr/__init__.pyi src/attr/_version_info.pyi src/attr/converters.pyi src/attr/exceptions.pyi src/attr/filters.pyi src/attr/setters.pyi src/attr/validators.pyi
mypy tests/typing_example.py
[testenv:pyright]
# Install and configure node and pyright
# This *could* be folded into a custom install_command
# Use nodeenv to configure node in the running tox virtual environment
# Seeing errors using "nodeenv -p"
# Use npm install -g to install "globally" into the virtual environment
basepython = python3.9
deps = nodeenv
commands =
nodeenv --prebuilt --node=lts --force {envdir}
npm install -g --no-package-lock --no-save pyright
pytest tests/test_pyright.py -vv