diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b3f082c9769..a36f9a8496d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -32,8 +32,7 @@ jobs: id: generate-python-key run: >- echo "::set-output name=key::base-venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('pylint/__pkg_info__.py', 'requirements_test.txt', 'setup.py', - 'setup.cfg', 'requirements_test_min.txt', 'requirements_docs.txt') }}" + hashFiles('pylint/__pkg_info__.py', 'setup.cfg') }}" - name: Restore Python virtual environment id: cache-venv uses: actions/cache@v2.1.4 @@ -50,9 +49,8 @@ jobs: python -m venv venv . venv/bin/activate python -m pip install -U pip setuptools wheel - pip install -U -r requirements_test.txt - pip install -U -r requirements_docs.txt - pip install -e . + pip install -U -e .[test_online] + pip install -U -e .[docs] - name: Generate pre-commit restore key id: generate-pre-commit-key run: >- @@ -194,8 +192,7 @@ jobs: id: generate-python-key run: >- echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('pylint/__pkg_info__.py', 'requirements_test.txt', 'setup.py', - 'setup.cfg', 'requirements_test_min.txt') }}" + hashFiles('pylint/__pkg_info__.py', 'setup.cfg') }}" - name: Restore Python virtual environment id: cache-venv uses: actions/cache@v2.1.4 @@ -212,8 +209,7 @@ jobs: python -m venv venv . venv/bin/activate python -m pip install -U pip setuptools wheel - pip install -U -r requirements_test.txt - pip install -e . + pip install -e .[test_online] -U pytest-linux: name: Run tests Python ${{ matrix.python-version }} (Linux) @@ -366,7 +362,7 @@ jobs: id: generate-python-key run: >- echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('pylint/__pkg_info__.py', 'setup.py', 'setup.cfg', 'requirements_test_min.txt') }}" + hashFiles('pylint/__pkg_info__.py', 'setup.cfg') }}" - name: Restore Python virtual environment id: cache-venv uses: actions/cache@v2.1.4 @@ -383,8 +379,7 @@ jobs: python -m venv venv . venv\\Scripts\\activate python -m pip install -U pip setuptools wheel - pip install -U -r requirements_test_min.txt - pip install -e . + pip install -U -e .[test_minimal] pytest-windows: name: Run tests Python ${{ matrix.python-version }} (Windows) @@ -444,7 +439,7 @@ jobs: id: generate-python-key run: >- echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('pylint/__pkg_info__.py', 'setup.py', 'setup.cfg', 'requirements_test_min.txt') }}" + hashFiles('pylint/__pkg_info__.py', 'setup.cfg') }}" - name: Restore Python virtual environment id: cache-venv uses: actions/cache@v2.1.4 @@ -461,8 +456,8 @@ jobs: python -m venv venv . venv/bin/activate python -m pip install -U pip setuptools wheel - pip install -U -r requirements_test_min.txt - pip install -e . + pip install -e .[test_minimal] -U + pytest-pypy: name: Run tests Python ${{ matrix.python-version }} diff --git a/requirements_docs.txt b/requirements_docs.txt deleted file mode 100644 index cecbaad52d8..00000000000 --- a/requirements_docs.txt +++ /dev/null @@ -1,2 +0,0 @@ -Sphinx==3.5.3 -python-docs-theme==2020.12 diff --git a/requirements_test.txt b/requirements_test.txt deleted file mode 100644 index 28e29724cd8..00000000000 --- a/requirements_test.txt +++ /dev/null @@ -1,9 +0,0 @@ --r requirements_test_pre_commit.txt --r requirements_test_min.txt -coveralls~=3.0 -coverage~=5.5 -pre-commit~=2.11 -pyenchant~=3.2 -pytest-cov~=2.11 -pytest-profiling~=1.7 -pytest-xdist~=2.2 diff --git a/requirements_test_min.txt b/requirements_test_min.txt deleted file mode 100644 index 4fadec38d84..00000000000 --- a/requirements_test_min.txt +++ /dev/null @@ -1,2 +0,0 @@ -pytest~=6.2 -pytest-benchmark~=3.2 diff --git a/requirements_test_pre_commit.txt b/requirements_test_pre_commit.txt deleted file mode 100644 index d9f5fba3b10..00000000000 --- a/requirements_test_pre_commit.txt +++ /dev/null @@ -1,7 +0,0 @@ -autoflake==1.4 -black==20.8b1 -flake8==3.9.0 -isort==5.8.0 -mypy==0.812 -pyupgrade==2.11.0 -black-disable-checker==1.0.0 diff --git a/setup.cfg b/setup.cfg index fc526768570..3fef20758a4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,10 +35,11 @@ classifiers = Topic :: Software Development :: Testing [options] +zip_safe = True packages = find: python_requires = ~=3.6 +py_modules = easy_install setup_requires = - install_requires = astroid>=2.5.2,<2.7 isort>=4.2.5,<6 @@ -53,6 +54,33 @@ console_scripts = pyreverse = pylint:run_pyreverse symilar = pylint:run_symilar +[options.extras_require] +docs = + Sphinx==3.5.3 + python-docs-theme==2020.12 + +test_minimal = + pytest~=6.2 + pytest-benchmark~=3.2 + pytest-cov~=2.11 + +test_pre_commit = + pre-commit~=2.11 + autoflake==1.4 + black==20.8b1 + flake8==3.9.0 + isort==5.8.0 + mypy==0.812 + pyupgrade==2.11.0 + black-disable-checker==1.0.0 + +test_online = + coveralls~=3.0 + coverage~=5.5 + pyenchant~=3.2 + pytest-profiling~=1.7 + pytest-xdist~=2.2 + [aliases] test = pytest diff --git a/setup.py b/setup.py index fd986e98ca8..47877d554c8 100644 --- a/setup.py +++ b/setup.py @@ -12,28 +12,5 @@ with open(HERE / "pylint/__pkginfo__.py", encoding="UTF-8") as f: exec(f.read(), __pkginfo__) # pylint: disable=exec-used -with open(HERE / "requirements_docs.txt", encoding="UTF-8") as f: - doc_extra_requires = f.readlines() - -with open(HERE / "requirements_test_min.txt", encoding="UTF-8") as f: - test_requires = f.readlines() - -DEV_REQUIREMENTS_FILES = ["requirements_test.txt", "requirements_test_pre_commit.txt"] -dev_extra_requires = doc_extra_requires + test_requires -for requirement_file in DEV_REQUIREMENTS_FILES: - with open(HERE / requirement_file, encoding="UTF-8") as f: - dev_extra_requires += [ - line for line in f.readlines() if not line.startswith("-r") - ] - - if __name__ == "__main__": - setup( - version=__pkginfo__["__version__"], - tests_require=test_requires, - extras_require={ - ':sys_platform=="win32"': ["colorama"], - "docs": doc_extra_requires, - "dev": dev_extra_requires, - }, - ) + setup(version=__pkginfo__["__version__"]) diff --git a/tox.ini b/tox.ini index c079d4e2c2f..560661008ba 100644 --- a/tox.ini +++ b/tox.ini @@ -6,8 +6,8 @@ skip_missing_interpreters = true [testenv:pylint] deps = - -r {toxinidir}/requirements_test_min.txt - pre-commit==2.10.1 + -e {toxinidir}[test_minimal] + pre-commit~=2.11 commands = pre-commit run pylint --all-files @@ -15,8 +15,8 @@ commands = [testenv:formatting] basepython = python3 deps = - -r {toxinidir}/requirements_test_min.txt - pre-commit==2.10.1 + -e {toxinidir}[test_minimal] + pre-commit~=2.11 commands = pre-commit run --all-files @@ -24,7 +24,7 @@ commands = [testenv:mypy] basepython = python3 deps = - pre-commit==2.10.1 + pre-commit~=2.11 commands = pre-commit run mypy --all-files @@ -33,7 +33,7 @@ commands = setenv = COVERAGE_FILE = {toxinidir}/.coverage.{envname} deps = - -r {toxinidir}/requirements_test.txt + -e {toxinidir}[test_online] commands = ; Run tests, ensuring all benchmark tests do not run pytest --benchmark-disable {toxinidir}/tests/ {posargs:} @@ -41,7 +41,7 @@ commands = [testenv:spelling] deps = - -r {toxinidir}/requirements_test.txt + -e {toxinidir}[test_online] commands = pytest {toxinidir}/tests/ {posargs:} -k unittest_spelling @@ -50,7 +50,7 @@ commands = setenv = COVERAGE_FILE = {toxinidir}/.coverage deps = - -r {toxinidir}/requirements_test.txt + -e {toxinidir}[test_online] skip_install = true commands = coverage combine @@ -60,32 +60,28 @@ commands = [testenv:docs] changedir = doc/ deps = - -r {toxinidir}/requirements_docs.txt + -e {toxinidir}[docs] commands = sphinx-build -W -b html -d _build/doctrees . _build/html [testenv:benchmark] deps = - -r {toxinidir}/requirements_test.txt + -e {toxinidir}[test_online] pygal commands = ; Run the only the benchmark tests, grouping output and forcing .json output so we ; can compare benchmark runs - pytest --exitfirst \ - --failed-first \ - --benchmark-only \ - --benchmark-save=batch_files \ - --benchmark-save-data \ - --benchmark-autosave {toxinidir}/tests \ - --benchmark-group-by="group" \ - {posargs:} + pytest --exitfirst --failed-first --benchmark-only \ + --benchmark-save=batch_files --benchmark-save-data \ + --benchmark-autosave {toxinidir}/tests --benchmark-group-by="group" \ + {posargs:} [testenv:profile_against_external] setenv = PYTEST_PROFILE_EXTERNAL = 1 deps = - -r {toxinidir}/requirements_test.txt + -e {toxinidir}[test_online] gprof2dot commands = pytest --exitfirst \