mirror of
https://github.com/enpaul/tox-poetry-installer.git
synced 2025-10-28 07:00:43 +00:00
Compare commits
65 Commits
0.8.4
...
079aae0556
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
079aae0556 | ||
|
|
0b0c2183a1 | ||
| e875008bff | |||
|
ef3cf00e6b
|
|||
|
230d3cffd9
|
|||
|
873e1a719c
|
|||
| f6dab542d0 | |||
|
7f004fd7e2
|
|||
| 76cc63e685 | |||
|
|
9efcea762e | ||
|
|
fe95ff5ca1 | ||
|
|
6991f29b4d | ||
|
|
2b8936267e | ||
|
|
3f99f3476c | ||
|
|
46a7619c4f | ||
|
|
c81215bc3b | ||
|
|
0693ce4706 | ||
|
|
a489fe2c53 | ||
|
|
a94933e7ef | ||
|
c55ba474c7
|
|||
| 2b75f74996 | |||
|
449381ca09
|
|||
|
bb44db0f9d
|
|||
|
afaf025485
|
|||
|
c984abbc2f
|
|||
|
cee49ff6c0
|
|||
|
11a478bd4e
|
|||
|
5e26a4e0de
|
|||
| c6c35636cd | |||
|
|
bc75c57126 | ||
|
|
7e5bc30b93 | ||
|
|
593f260278 | ||
|
779dd8c56f
|
|||
|
3399bbecc2
|
|||
|
dd61f8c40f
|
|||
| 447475ebe0 | |||
|
d711a17596
|
|||
|
4f69c8b3b2
|
|||
| bd102605b6 | |||
|
469cb251cf
|
|||
| 41ac5423f9 | |||
|
3388553ee0
|
|||
|
52f34cb317
|
|||
|
4c609770f1
|
|||
| d5650f0562 | |||
|
4261d45218
|
|||
|
d0842456cb
|
|||
|
b631a962b2
|
|||
|
453b575159
|
|||
| 50e1aaddcd | |||
|
|
d0efbd06b3 | ||
|
c435f1af69
|
|||
|
817ae28a23
|
|||
| 12c4ec62f2 | |||
|
|
73ddd43284 | ||
|
|
a181da95b3 | ||
|
|
e8ce2f391b | ||
|
|
c8fd6e4fc0 | ||
|
|
22012d4452 | ||
|
|
17d0272089 | ||
|
|
b54bf44dc5 | ||
| 17885b50f7 | |||
|
72c719c26c
|
|||
|
5f30656683
|
|||
| b3a5e869ac |
2
.github/scripts/setup-env.sh
vendored
2
.github/scripts/setup-env.sh
vendored
@@ -8,7 +8,7 @@
|
||||
set -e;
|
||||
|
||||
CI_CACHE=$HOME/.cache;
|
||||
POETRY_VERSION=1.1.12;
|
||||
POETRY_VERSION=1.3.2;
|
||||
|
||||
mkdir --parents "$CI_CACHE";
|
||||
|
||||
|
||||
35
.github/workflows/ci.yaml
vendored
35
.github/workflows/ci.yaml
vendored
@@ -7,12 +7,11 @@ on:
|
||||
branches: ["devel"]
|
||||
jobs:
|
||||
Test:
|
||||
name: Python ${{ matrix.python.version }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python:
|
||||
- version: "3.6"
|
||||
toxenv: py36
|
||||
- version: "3.7"
|
||||
toxenv: py37
|
||||
- version: "3.8"
|
||||
@@ -21,15 +20,20 @@ jobs:
|
||||
toxenv: py39
|
||||
- version: "3.10"
|
||||
toxenv: py310
|
||||
- version: "3.11"
|
||||
toxenv: py311
|
||||
fail-fast: true
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install Python ${{ matrix.python.version }}
|
||||
uses: actions/setup-python@v1
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python.version }}
|
||||
|
||||
- name: Configure Job Cache
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cache/pip
|
||||
@@ -39,38 +43,49 @@ jobs:
|
||||
# will be invalidated, and thus all packages will be redownloaded, if the
|
||||
# lockfile is updated
|
||||
key: ${{ runner.os }}-${{ matrix.python.toxenv }}-${{ hashFiles('**/poetry.lock') }}
|
||||
|
||||
- name: Configure Path
|
||||
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Configure Environment
|
||||
run: .github/scripts/setup-env.sh
|
||||
|
||||
- name: Run Toxenv ${{ matrix.python.toxenv }}
|
||||
run: poetry run tox -e ${{ matrix.python.toxenv }}
|
||||
|
||||
Check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Install Python 3.8
|
||||
uses: actions/setup-python@v1
|
||||
|
||||
- name: Install Python 3.10
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.8
|
||||
python-version: "3.10"
|
||||
|
||||
- name: Configure Job Cache
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cache/pip
|
||||
~/.cache/pypoetry/cache
|
||||
~/.poetry
|
||||
# Hardcoded 'py38' slug here lets this cache piggyback on the 'py38' cache
|
||||
# Hardcoded 'py310' slug here lets this cache piggyback on the 'py310' cache
|
||||
# that is generated for the tests above
|
||||
key: ${{ runner.os }}-py38-${{ hashFiles('**/poetry.lock') }}
|
||||
key: ${{ runner.os }}-py310-${{ hashFiles('**/poetry.lock') }}
|
||||
|
||||
- name: Configure Path
|
||||
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Configure Environment
|
||||
run: .github/scripts/setup-env.sh
|
||||
|
||||
- name: Run Static Analysis Checks
|
||||
run: poetry run tox -e static
|
||||
|
||||
- name: Run Static Analysis Checks (Tests)
|
||||
run: poetry run tox -e static-tests
|
||||
|
||||
- name: Run Security Checks
|
||||
run: poetry run tox -e security
|
||||
|
||||
120
CHANGELOG.md
120
CHANGELOG.md
@@ -2,14 +2,87 @@
|
||||
|
||||
See also: [Github Release Page](https://github.com/enpaul/tox-poetry-installer/releases).
|
||||
|
||||
## Version 1.0.0 Beta 1
|
||||
|
||||
View this release on:
|
||||
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/1.0.0b1),
|
||||
[PyPI](https://pypi.org/project/tox-poetry-installer/1.0.0b1)
|
||||
|
||||
- Update Poetry compatibility to include >=1.5
|
||||
- Update Tox compatibility to use Tox 4
|
||||
- Remove support for Tox 3
|
||||
- Remove deprecated `--require-poetry` command line option
|
||||
- Remove deprecated `install_dev_deps` confguration option
|
||||
- Remove deprecated `--parallelize-locked-install` command line option
|
||||
|
||||
## Version 0.10.3
|
||||
|
||||
View this release on:
|
||||
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.10.3),
|
||||
[PyPI](https://pypi.org/project/tox-poetry-installer/0.10.3/)
|
||||
|
||||
- Update Poetry requirement to exclude usage with incompatible 1.5 release
|
||||
|
||||
## Version 0.10.2
|
||||
|
||||
View this release on:
|
||||
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.10.2),
|
||||
[PyPI](https://pypi.org/project/tox-poetry-installer/0.10.2/)
|
||||
|
||||
- Update documentation with best practices and Poetry 1.2+ command syntax
|
||||
- Fix failed install of sdist package not raising an exception in multi-threaded mode.
|
||||
Contributed by [chriskuehl](https://github.com/chriskuehl) (#86)
|
||||
|
||||
## Version 0.10.1
|
||||
|
||||
View this release on:
|
||||
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.10.1),
|
||||
[PyPI](https://pypi.org/project/tox-poetry-installer/0.10.1/)
|
||||
|
||||
- Add PyPI classifier for Python-3.11 compatibility
|
||||
- Add CI support for Python-3.11
|
||||
- Add support for Poetry-1.3.x (#83)
|
||||
|
||||
## Version 0.10.0
|
||||
|
||||
View this release on:
|
||||
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.10.0),
|
||||
[PyPI](https://pypi.org/project/tox-poetry-installer/0.10.0/)
|
||||
|
||||
- Add `poetry_dep_groups` option to support installing groups of Poetry dependencies.
|
||||
Contributed by [Oshmoun](https://github.com/oshmoun) (#76)
|
||||
- Deprecate `install_dev_deps` option
|
||||
|
||||
## Version 0.9.0
|
||||
|
||||
View this release on:
|
||||
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.9.0),
|
||||
[PyPI](https://pypi.org/project/tox-poetry-installer/0.9.0/)
|
||||
|
||||
- Add support for Poetry-1.2.x. Contributed by [Justin Wood](https://github.com/Callek)
|
||||
(#73)
|
||||
- Update Black formatting to stable release version
|
||||
- Remove support for Python-3.6
|
||||
- Remove support for Poetry-1.1.x
|
||||
- Fix installing dependencies multiple times when transient dependencies are duplicated in
|
||||
the dependency tree
|
||||
|
||||
## Version 0.8.5
|
||||
|
||||
View this release on:
|
||||
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.8.5),
|
||||
[PyPI](https://pypi.org/project/tox-poetry-installer/0.8.5/)
|
||||
|
||||
- Fix Poetry version specification supporting the incompatible Poetry-1.2.0 release
|
||||
|
||||
## Version 0.8.4
|
||||
|
||||
View this release on:
|
||||
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.8.4),
|
||||
[PyPI](https://pypi.org/project/tox-poetry-installer/0.8.4/)
|
||||
|
||||
- Fix issue where incompatible package versions were selected for installation when multiple
|
||||
package versions were in the lockfile
|
||||
- Fix issue where incompatible package versions were selected for installation when
|
||||
multiple package versions were in the lockfile
|
||||
|
||||
## Version 0.8.3
|
||||
|
||||
@@ -26,9 +99,9 @@ View this release on:
|
||||
[PyPI](https://pypi.org/project/tox-poetry-installer/0.8.2/)
|
||||
|
||||
- Improve debug-level logging for package installation, and time how long installing each
|
||||
package takes. Contributed by [Rebecca
|
||||
Turner](https://github.com/9999years).
|
||||
- Fix crash caused by the package-under-test depending on Poetry's unsafe dependencies ([#65](https://github.com/enpaul/tox-poetry-installer/issues/65))
|
||||
package takes. Contributed by [Rebecca Turner](https://github.com/9999years) (#63).
|
||||
- Fix crash caused by the package-under-test depending on Poetry's unsafe dependencies
|
||||
([#65](https://github.com/enpaul/tox-poetry-installer/issues/65))
|
||||
|
||||
## Version 0.8.1
|
||||
|
||||
@@ -78,7 +151,8 @@ View this release on:
|
||||
process
|
||||
- Add integration with Poetry's compatibility
|
||||
[`Marker`](https://github.com/python-poetry/poetry-core/blob/master/poetry/core/version/markers.py)
|
||||
object system for determining package compatibility with the current platform ([#43](https://github.com/enpaul/tox-poetry-installer/issues/43))
|
||||
object system for determining package compatibility with the current platform
|
||||
([#43](https://github.com/enpaul/tox-poetry-installer/issues/43))
|
||||
- Add missing PyPI classifier for Python 3
|
||||
|
||||
## Version 0.6.3
|
||||
@@ -103,8 +177,8 @@ View this release on:
|
||||
[CVE-2020-29651](https://nvd.nist.gov/vuln/detail/CVE-2020-29651)
|
||||
- Fix dependency identification failing when the package under test is a transient
|
||||
dependency of a locked dependency specified for installation
|
||||
- Fix `AttributeError` being raised while creating the Tox self-provisioned environment when
|
||||
using either the
|
||||
- Fix `AttributeError` being raised while creating the Tox self-provisioned environment
|
||||
when using either the
|
||||
[`minversion`](https://tox.readthedocs.io/en/latest/config.html#conf-minversion) or
|
||||
[`requires`](https://tox.readthedocs.io/en/latest/config.html#conf-requires) Tox config
|
||||
options
|
||||
@@ -119,8 +193,8 @@ View this release on:
|
||||
installation problems
|
||||
- Fix regression around handling of Poetry's unsafe packages when the unsafe package is a
|
||||
transient dependency ([#33](https://github.com/enpaul/tox-poetry-installer/issues/33))
|
||||
- Fix handling of Poetry's unsafe packages when the unsafe package is a primary (environment
|
||||
or package) dependency
|
||||
- Fix handling of Poetry's unsafe packages when the unsafe package is a primary
|
||||
(environment or package) dependency
|
||||
|
||||
## Version 0.6.0
|
||||
|
||||
@@ -144,7 +218,8 @@ View this release on:
|
||||
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.5.2),
|
||||
[PyPI](https://pypi.org/project/tox-poetry-installer/0.5.2/)
|
||||
|
||||
- Fix always attempting to install dependencies with incompatible python version constraints
|
||||
- Fix always attempting to install dependencies with incompatible python version
|
||||
constraints
|
||||
- Fix always attempting to install dependencies with incompatible python platforms
|
||||
|
||||
## Version 0.5.1
|
||||
@@ -166,8 +241,8 @@ View this release on:
|
||||
|
||||
- Add option `locked_deps` to better support both locked and unlocked dependencies in a
|
||||
single environment
|
||||
- Add blocking functionality when using `require_locked_deps = true` to prevent other hooks
|
||||
from running after this one
|
||||
- Add blocking functionality when using `require_locked_deps = true` to prevent other
|
||||
hooks from running after this one
|
||||
- Update documentation to include new configuration options and errors
|
||||
- Update documentation to improve future maintainability
|
||||
- Update module structure to move from single-file module to multi-file directory module
|
||||
@@ -191,7 +266,8 @@ View this release on:
|
||||
[PyPI](https://pypi.org/project/tox-poetry-installer/0.3.1/)
|
||||
|
||||
- Fix error when installing an environment with no extras specified in the configuration
|
||||
- Fix problem where only the dependencies of the sequentially last extra would be installed
|
||||
- Fix problem where only the dependencies of the sequentially last extra would be
|
||||
installed
|
||||
- Fix regression causing no project dependencies to be installed
|
||||
|
||||
## Version 0.3.0
|
||||
@@ -213,7 +289,8 @@ View this release on:
|
||||
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.2.4),
|
||||
[PyPI](https://pypi.org/project/tox-poetry-installer/0.2.4/)
|
||||
|
||||
- Fix support for Poetry-1.1 ([#2](https://github.com/enpaul/tox-poetry-installer/issues/2))
|
||||
- Fix support for Poetry-1.1
|
||||
([#2](https://github.com/enpaul/tox-poetry-installer/issues/2))
|
||||
- Include tests in sdist ([#8](https://github.com/enpaul/tox-poetry-installer/issues/8))
|
||||
|
||||
## Version 0.2.3
|
||||
@@ -222,8 +299,10 @@ View this release on:
|
||||
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.2.3),
|
||||
[PyPI](https://pypi.org/project/tox-poetry-installer/0.2.3/)
|
||||
|
||||
- Fix usage of the plugin in non-Poetry based projects ([#1](https://github.com/enpaul/tox-poetry-installer/issues/1))
|
||||
- Fix treating dependency names as case sensitive when they shouldn't be ([#7](https://github.com/enpaul/tox-poetry-installer/issues/7))
|
||||
- Fix usage of the plugin in non-Poetry based projects
|
||||
([#1](https://github.com/enpaul/tox-poetry-installer/issues/1))
|
||||
- Fix treating dependency names as case sensitive when they shouldn't be
|
||||
([#7](https://github.com/enpaul/tox-poetry-installer/issues/7))
|
||||
|
||||
## Version 0.2.2
|
||||
|
||||
@@ -232,7 +311,8 @@ View this release on:
|
||||
[PyPI](https://pypi.org/project/tox-poetry-installer/0.2.2/)
|
||||
|
||||
- Fix breaking when running Tox in projects that do not use Poetry for their
|
||||
environment/dependency management ([#1](https://github.com/enpaul/tox-poetry-installer/issues/1))
|
||||
environment/dependency management
|
||||
([#1](https://github.com/enpaul/tox-poetry-installer/issues/1))
|
||||
|
||||
## Version 0.2.1
|
||||
|
||||
@@ -283,8 +363,8 @@ View this release on:
|
||||
[PyPI](https://pypi.org/project/tox-poetry-installer/0.1.2/)
|
||||
|
||||
- Test trivial functionality on Python-3.6 and Python-3.7
|
||||
- Fix disagreement between `pyproject.toml` and module metadata on what the current version
|
||||
is
|
||||
- Fix disagreement between `pyproject.toml` and module metadata on what the current
|
||||
version is
|
||||
- Fix constant named for PEP-440 that should have been named for PEP-508
|
||||
|
||||
## Version 0.1.1
|
||||
|
||||
@@ -27,9 +27,10 @@ Examples of unacceptable behavior include:
|
||||
- The use of sexualized language or imagery, and sexual attention or advances of any kind
|
||||
- Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
- Public or private harassment
|
||||
- Publishing others' private information, such as a physical or email address, without their
|
||||
explicit permission
|
||||
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
- Publishing others' private information, such as a physical or email address, without
|
||||
their explicit permission
|
||||
- Other conduct which could reasonably be considered inappropriate in a professional
|
||||
setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
@@ -52,8 +53,8 @@ offline event.
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the
|
||||
community leaders responsible for enforcement at \[INSERT CONTACT METHOD\]. All
|
||||
complaints will be reviewed and investigated promptly and fairly.
|
||||
community leaders responsible for enforcement at \[INSERT CONTACT METHOD\]. All complaints
|
||||
will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the reporter of
|
||||
any incident.
|
||||
@@ -105,8 +106,8 @@ toward or disparagement of classes of individuals.
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
||||
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
||||
|
||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||
enforcement ladder](https://github.com/mozilla/diversity).
|
||||
Community Impact Guidelines were inspired by
|
||||
[Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
https://www.contributor-covenant.org/faq. Translations are available at
|
||||
|
||||
4
Makefile
4
Makefile
@@ -30,10 +30,10 @@ source: ## Build Python source distribution package
|
||||
poetry build --format sdist
|
||||
|
||||
test: ## Run the project testsuite(s)
|
||||
poetry run tox --recreate
|
||||
poetry run tox --recreate --parallel
|
||||
|
||||
dev: ## Create the local dev environment
|
||||
poetry install -E poetry
|
||||
poetry install --extras poetry --sync
|
||||
poetry run pre-commit install
|
||||
|
||||
publish: test wheel source ## Build and upload to pypi (requires $PYPI_API_KEY be set)
|
||||
|
||||
170
README.md
170
README.md
@@ -25,7 +25,6 @@ environment dependencies from the [Poetry](https://python-poetry.org/) lockfile.
|
||||
- [Other Notes](#other-notes)
|
||||
- [Unsupported Tox config options](#unsupported-tox-config-options)
|
||||
- [Updating locked dependencies in a testenv](#updating-locked-dependencies-in-a-testenv)
|
||||
- [Installing unsafe dependencies](#installing-unsafe-dependencies)
|
||||
- [Using with an unmanaged Poetry installation](#using-with-an-unmanaged-poetry-installation)
|
||||
- [Developing the Plugin](#developer-documentation)
|
||||
- [Road Map](#road-map)
|
||||
@@ -34,16 +33,17 @@ See the
|
||||
[Changelog](https://github.com/enpaul/tox-poetry-installer/blob/devel/CHANGELOG.md) for
|
||||
release history.
|
||||
|
||||
*See also: [official Tox plugins](https://tox.readthedocs.io/en/latest/plugins.html), [Poetry-Dev-Dependencies Tox plugin](https://github.com/sinoroc/tox-poetry-dev-dependencies), [Poetry Tox plugin](https://github.com/tkukushkin/tox-poetry)*
|
||||
*See also: [official Tox plugins](https://tox.readthedocs.io/en/latest/plugins.html) and
|
||||
[the official Poetry documentation on using Tox](https://python-poetry.org/docs/faq/#is-tox-supported)*
|
||||
|
||||
## Feature Overview
|
||||
|
||||
- Manage package versions in exactly one place and with exactly one tool: Poetry.
|
||||
- Ensure CI/CD and other automation tools are using the same package versions that you are
|
||||
in your local development environment.
|
||||
- Add only the packages you need to a Tox test environment, instead of everything in your
|
||||
lockfile.
|
||||
- Directly integrate with Poetry, re-using your existing package indexes and credentials
|
||||
- Add only the packages or custom groups you need to a Tox test environment, instead of
|
||||
everything in your lockfile.
|
||||
- Directly integrate with Poetry, re-using your existing package indexes and credentials,
|
||||
with no additional configuration.
|
||||
- Wherever possible, built-in Tox config options are always respected and their behavior
|
||||
kept consistent.
|
||||
@@ -53,17 +53,19 @@ release history.
|
||||
|
||||
## User Documentation
|
||||
|
||||
*This section is for users looking to integrate the plugin with their project or CI system. For information on contributing to the plugin please see the [Developer Docs](#developer-documentation)*
|
||||
*This section is for users looking to integrate the plugin with their project or CI
|
||||
system. For information on contributing to the plugin please see the
|
||||
[Developer Docs](#developer-documentation)*
|
||||
|
||||
### Installing
|
||||
|
||||
The recommended way to install the plugin is to add it to a project using Poetry:
|
||||
|
||||
```bash
|
||||
poetry add tox-poetry-installer[poetry] --dev
|
||||
poetry add -G dev tox-poetry-installer[poetry]
|
||||
```
|
||||
|
||||
> **Note:** Always install the plugin with the `[poetry]` extra, unless you are
|
||||
> ℹ️ **Note:** Always install the plugin with the `[poetry]` extra, unless you are
|
||||
> [managing the Poetry installation yourself](#externally-managed-poetry-installation).
|
||||
|
||||
Alternatively, it can be installed directly to a virtual environment using Pip, though
|
||||
@@ -80,16 +82,16 @@ adding the below to `tox.ini`, though this is also not recommended:
|
||||
|
||||
```ini
|
||||
requires =
|
||||
tox-poetry-installer[poetry] == 0.8.0
|
||||
tox-poetry-installer[poetry] == 0.10.2
|
||||
```
|
||||
|
||||
After installing, check that Tox recognizes the plugin by running
|
||||
`poetry run tox --version`. The command should give output similar to below:
|
||||
|
||||
```
|
||||
3.20.0 imported from .venv/lib64/python3.8/site-packages/tox/__init__.py
|
||||
3.20.0 imported from .venv/lib64/python3.10/site-packages/tox/__init__.py
|
||||
registered plugins:
|
||||
tox-poetry-installer-0.8.0 at .venv/lib64/python3.8/site-packages/tox_poetry_installer/__init__.py
|
||||
tox-poetry-installer-0.10.2 at .venv/lib64/python3.10/site-packages/tox_poetry_installer/__init__.py
|
||||
```
|
||||
|
||||
### Quick Start
|
||||
@@ -146,23 +148,24 @@ locked_deps =
|
||||
commands = ...
|
||||
```
|
||||
|
||||
> **Note:** Settings configured on the main `testenv` environment are inherited by child
|
||||
> test environments (for example, `testenv:foo`). To override this, specify the setting in
|
||||
> the child environment with a different value.
|
||||
> ℹ️ **Note:** Settings configured on the main `testenv` environment are inherited by
|
||||
> child test environments (for example, `testenv:foo`). To override this, specify the
|
||||
> setting in the child environment with a different value.
|
||||
|
||||
Alternatively, we can skip specifying all of our dependencies for a test environment in
|
||||
the Tox config and just install all of our Poetry dev-dependencies automatically:
|
||||
the Tox config and install Poetry dependency groups directly:
|
||||
|
||||
```ini
|
||||
[testenv]
|
||||
description = Some very cool tests
|
||||
require_locked_deps = true
|
||||
install_dev_deps = true
|
||||
poetry_dep_groups =
|
||||
dev
|
||||
commands = ...
|
||||
```
|
||||
|
||||
> **Note:** Setting `install_dev_deps = true` on an environment that also installs the
|
||||
> project package is functionally equivalent to running `poetry install`.
|
||||
> ℹ️ **Note:** The `install_dev_deps` configuration option is deprecated. See
|
||||
> [Configuration Options](#configuration-options) for more information.
|
||||
|
||||
Finally, we can also install an unlocked dependency (a dependency which doesn't take its
|
||||
version from the Poetry lockfile) into the test environment alongside the locked ones. We
|
||||
@@ -190,17 +193,17 @@ All options listed below are Tox environment options and can be applied to one o
|
||||
environment sections of the `tox.ini` file. They cannot be applied to the global Tox
|
||||
configuration section.
|
||||
|
||||
> **Note:** Settings configured on the main `testenv` environment are inherited by child
|
||||
> test environments (for example, `testenv:foo`). To override this, specify the setting in
|
||||
> the child environment with a different value.
|
||||
> ℹ️ **Note:** Settings configured on the main `testenv` environment are inherited by
|
||||
> child test environments (for example, `testenv:foo`). To override this, specify the
|
||||
> setting in the child environment with a different value.
|
||||
|
||||
| Option | Type | Default | Description |
|
||||
| :--------------------- | :-----: | :-----: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `locked_deps` | List | `[]` | Names of packages to install to the test environment from the Poetry lockfile. Transient dependencies (packages required by these dependencies) are automatically included. |
|
||||
| `require_locked_deps` | Boolean | False | Whether the plugin should block attempts to install unlocked dependencies to the test environment. If enabled, then the [`tox_testenv_install_deps`](https://tox.readthedocs.io/en/latest/plugins.html#tox.hookspecs.tox_testenv_install_deps) plugin hook will be intercepted and an error will be raised if the test environment has the `deps` option configured. |
|
||||
| `install_dev_deps` | Boolean | False | Whether all of the Poetry dev-dependencies should be installed to the test environment. |
|
||||
| `install_project_deps` | Boolean | True | Whether all of the Poetry primary dependencies for the project package should be installed to the test environment. |
|
||||
| `require_poetry` | Boolean | False | Whether Tox should be forced to fail if the plugin cannot import Poetry locally. If `False` then the plugin will be skipped for the test environment if Poetry cannot be imported. If `True` then the plugin will force the environment to error and the Tox run to fail. |
|
||||
| `poetry_dep_groups` | List | `[]` | Names of Poetry dependency groups specified in `pyproject.toml` to install to the test environment. |
|
||||
|
||||
### Runtime Options
|
||||
|
||||
@@ -211,13 +214,6 @@ of the plugin.
|
||||
| :--------------------------- | :-----: | :-----: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `--parallel-install-threads` | Integer | `10` | Number of worker threads to use to install dependencies in parallel. Installing in parallel with more threads can greatly speed up the install process, but can cause race conditions during install. Pass this option with the value `0` to entirely disable parallel installation. |
|
||||
|
||||
> **Note:** The `--require-poetry` runtime option is deprecated and will be removed in
|
||||
> version 1.0.0. Please set `require_poetry = true` in `tox.ini` for environments that
|
||||
> should fail if Poetry is not available.
|
||||
|
||||
> **Note:** The `--parallelize-locked-install` option is deprecated and will be removed in
|
||||
> version 1.0.0. Please use the `--parallel-install-threads` option.
|
||||
|
||||
### Errors
|
||||
|
||||
There are several errors that the plugin can encounter for a test environment when Tox is
|
||||
@@ -230,12 +226,12 @@ error will be set to one of the "Status" values below to indicate what the error
|
||||
| `LockedDepVersionConflictError` | Indicates that an item in the `locked_deps` config option includes a [PEP-508 version specifier](https://www.python.org/dev/peps/pep-0508/#grammar) (ex: `pytest >=6.0, <6.1`). |
|
||||
| `LockedDepNotFoundError` | Indicates that an item specified in the `locked_deps` config option does not match the name of a package in the Poetry lockfile. |
|
||||
| `LockedDepsRequiredError` | Indicates that a test environment with the `require_locked_deps` config option set to `true` also specified unlocked dependencies using the [`deps`](https://tox.readthedocs.io/en/latest/config.html#conf-deps) config option. |
|
||||
| `PoetryNotInstalledError` | Indicates that the `poetry` module could not be imported under the current runtime environment, and the `--require-poetry` flag was provided. |
|
||||
| `PoetryNotInstalledError` | Indicates that the `poetry` module could not be imported under the current runtime environment, and `require_poetry = true` was specified. |
|
||||
| `RequiresUnsafeDepError` | Indicates that the package-under-test depends on a package that Poetry has classified as unsafe and cannot be installed. |
|
||||
|
||||
> **Note:** One or more of these errors can be caused by the `pyproject.toml` being out of
|
||||
> sync with the Poetry lockfile. If this is the case, than a warning will be logged when Tox
|
||||
> is run.
|
||||
> ℹ️ **Note:** One or more of these errors can be caused by the `pyproject.toml` being out
|
||||
> of sync with the Poetry lockfile. If this is the case, than a warning will be logged
|
||||
> when Tox is run.
|
||||
|
||||
### Other Notes
|
||||
|
||||
@@ -246,8 +242,8 @@ these options are made obsolete by the Poetry lockfile: either they aren't neede
|
||||
equivalent functionality is instead taken directly from the package details Poetry stores
|
||||
in its lockfile.
|
||||
|
||||
> **Note:** The unsupported Tox config options will still apply to unlocked dependencies
|
||||
> being installed with the default Tox installation backend.
|
||||
> ℹ️ **Note:** The unsupported Tox config options will still apply to unlocked
|
||||
> dependencies being installed with the default Tox installation backend.
|
||||
|
||||
- [`install_command`](https://tox.readthedocs.io/en/latest/config.html#conf-install_command)
|
||||
- [`pip_pre`](https://tox.readthedocs.io/en/latest/config.html#conf-pip_pre)
|
||||
@@ -268,41 +264,24 @@ built-in
|
||||
[`--recreate`](https://tox.readthedocs.io/en/latest/example/basic.html#forcing-re-creation-of-virtual-environments)
|
||||
option) for the new version to be found and installed.
|
||||
|
||||
> **Note:** To force Tox to always recreate a test environment the
|
||||
> [`recreate`](https://tox.readthedocs.io/en/latest/config.html#conf-recreate) config option
|
||||
> can be set.
|
||||
|
||||
#### Installing unsafe dependencies
|
||||
|
||||
There are several packages that cannot be installed from the lockfile because they are
|
||||
excluded by Poetry itself. As a result these packages cannot be installed by this plugin
|
||||
either as test environment dependencies passed directly to `locked_deps` or as a transient
|
||||
dependency. When one of these packages is encountered by the plugin a warning will be
|
||||
logged to the console and
|
||||
**the unsafe package will not be installed to the test environment**.
|
||||
|
||||
This list can be found in the Poetry source code
|
||||
[here](https://github.com/python-poetry/poetry/blob/master/poetry/puzzle/provider.py). As
|
||||
of [Poetry 1.1.6](https://github.com/python-poetry/poetry/releases/tag/1.1.6) there are
|
||||
four packages classified as "unsafe" by Poetry and excluded from the lockfile:
|
||||
|
||||
- `setuptools`
|
||||
- `distribute`
|
||||
- `pip`
|
||||
- `wheel`
|
||||
> ℹ️ **Note:** To force Tox to always recreate a test environment the
|
||||
> [`recreate`](https://tox.readthedocs.io/en/latest/config.html#conf-recreate) config
|
||||
> option can be set.
|
||||
|
||||
#### Using with an unmanaged Poetry installation
|
||||
|
||||
In CI/CD systems, automation environments, or other Python environments where the loaded
|
||||
site packages are not managed by Poetry, it can be useful to manage the local installation
|
||||
of Poetry externally. This also helps to avoid problems that can be caused by the
|
||||
`--no-root`, `--no-dev`, or `--remove-untracked` arguments to the `poetry install` command
|
||||
which, in some situations, can cause Poetry to uninstall itself if Poetry is specified as
|
||||
a dependency of one of the packages it is managing (like this plugin). To support these
|
||||
use cases, this plugin specifies the `poetry` package as an optional dependency that can
|
||||
be installed using a setuptools extra also named `poetry`.
|
||||
`--no-root`, `--without dev`, or `--sync` arguments to the `poetry install` command which,
|
||||
in some situations, can cause Poetry to uninstall itself if Poetry is specified as a
|
||||
dependency of one of the packages it is managing (like this plugin). To support these use
|
||||
cases, this plugin specifies the `poetry` package as an optional dependency that can be
|
||||
installed using a setuptools extra also named `poetry`.
|
||||
|
||||
**Critical Warning: This plugin requires Poetry to function. If the plugin is installed without the `poetry` setuptools extra then Poetry must be installed independently for the plugin to function properly.**
|
||||
> ⚠️ **Warning:** This plugin requires Poetry to function. If the plugin is installed
|
||||
> without the `poetry` setuptools extra then Poetry must be installed independently for
|
||||
> the plugin to function properly.
|
||||
|
||||
To skip installing the `poetry` package as a dependency of `tox-poetry-installer`, do not
|
||||
specify the `poetry` extra when adding the plugin:
|
||||
@@ -310,11 +289,11 @@ specify the `poetry` extra when adding the plugin:
|
||||
```bash
|
||||
# Adding the package without the "[poetry]" extra specifier so that
|
||||
# Poetry is not added as a transient dev-dependency:
|
||||
poetry add tox-poetry-installer --dev
|
||||
poetry add -G dev tox-poetry-installer
|
||||
|
||||
# Adding the package with the "[poetry]" extra specifier, so the Poetry
|
||||
# package will be added to the environment and tracked in the lockfile:
|
||||
poetry add tox-poetry-installer[poetry] --dev
|
||||
poetry add -G dev tox-poetry-installer[poetry]
|
||||
```
|
||||
|
||||
Once the plugin is installed- either with or without the Poetry extra- you can validate
|
||||
@@ -330,14 +309,15 @@ python -c '\
|
||||
'
|
||||
```
|
||||
|
||||
> **Note:** To force Tox to fail if Poetry is not installed, add the `require_poetry = true`
|
||||
> option to the tox `[testenv]` configuration. See the
|
||||
> ℹ️ **Note:** To force Tox to fail if Poetry is not installed, add the
|
||||
> `require_poetry = true` option to the tox `[testenv]` configuration. See the
|
||||
> [Config Options](#configuration-options) for more information.
|
||||
|
||||
## Developer Documentation
|
||||
|
||||
All project contributors and participants are expected to adhere to the
|
||||
[Contributor Covenant Code of Conduct, v2](CODE_OF_CONDUCT.md) ([external link](https://www.contributor-covenant.org/version/2/0/code_of_conduct/)).
|
||||
[Contributor Covenant Code of Conduct, v2](CODE_OF_CONDUCT.md)
|
||||
([external link](https://www.contributor-covenant.org/version/2/0/code_of_conduct/)).
|
||||
|
||||
The `devel` branch has the latest (and potentially unstable) changes. The stable releases
|
||||
are tracked on [Github](https://github.com/enpaul/tox-poetry-installer/releases),
|
||||
@@ -352,8 +332,8 @@ are tracked on [Github](https://github.com/enpaul/tox-poetry-installer/releases)
|
||||
[fork the repository](https://docs.github.com/en/enterprise/2.20/user/github/getting-started-with-github/fork-a-repo)
|
||||
and [open a pull request](https://github.com/enpaul/tox-poetry-installer/compare).
|
||||
|
||||
Developing this project requires [Python 3.7+](https://www.python.org/downloads/) and
|
||||
[Poetry 1.0](https://python-poetry.org/docs/#installation) or later. GNU Make can
|
||||
Developing this project requires [Python 3.10+](https://www.python.org/downloads/) and
|
||||
[Poetry 1.4](https://python-poetry.org/docs/#installation) or later. GNU Make can
|
||||
optionally be used to quickly setup a local development environment, but this is not
|
||||
required.
|
||||
|
||||
@@ -368,26 +348,20 @@ git clone git@github.com:enpaul/tox-poetry-installer.git
|
||||
|
||||
cd tox-poetry-installer/
|
||||
|
||||
# Create and configure the local development environment...
|
||||
# ...with make:
|
||||
# Create and configure the local development environment
|
||||
make dev
|
||||
# ...manually:
|
||||
poetry install -E poetry --remove-untracked
|
||||
poetry run pre-commit install
|
||||
|
||||
# Run tests and CI locally...
|
||||
# ...with make:
|
||||
# Run tests and CI locally
|
||||
make test
|
||||
# ...manually:
|
||||
poetry run tox --recreate
|
||||
|
||||
# See additional make targets
|
||||
make help
|
||||
```
|
||||
|
||||
> **Note:** The pre-commit hooks require dependencies in the Poetry environment to run. To
|
||||
> make a commit with the pre-commit hooks, you will need to run `poetry run git commit` or,
|
||||
> alternatively, [launch an environment shell](https://python-poetry.org/docs/cli/#shell).
|
||||
> ℹ️ **Note:** The pre-commit hooks require dependencies in the Poetry environment to run.
|
||||
> To make a commit with the pre-commit hooks, you will need to run `poetry run git commit`
|
||||
> or, alternatively,
|
||||
> [launch an environment shell](https://python-poetry.org/docs/cli/#shell).
|
||||
|
||||
## Road Map
|
||||
|
||||
@@ -396,35 +370,39 @@ production environments on a provisional basis only.
|
||||
|
||||
- Beta classification was assigned with
|
||||
[v0.6.0](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.6.0)
|
||||
- Stable classification will be assigned when the test suite covers an acceptable number of
|
||||
use cases
|
||||
- Stable classification will be assigned when the test suite covers an acceptable number
|
||||
of use cases
|
||||
|
||||
### Path to Beta
|
||||
|
||||
- [x] Verify that primary package dependencies (from the `.package` env) are installed
|
||||
correctly using the Poetry backend.
|
||||
- [x] Support the [`extras`](https://tox.readthedocs.io/en/latest/config.html#conf-extras) Tox
|
||||
configuration option ([#4](https://github.com/enpaul/tox-poetry-installer/issues/4))
|
||||
- [x] Support the [`extras`](https://tox.readthedocs.io/en/latest/config.html#conf-extras)
|
||||
Tox configuration option ([#4](https://github.com/enpaul/tox-poetry-installer/issues/4))
|
||||
- [x] Add per-environment Tox configuration option to fall back to default installation
|
||||
backend.
|
||||
- [ ] ~Add warnings when an unsupported Tox configuration option is detected while using the
|
||||
Poetry backend.~ ([#5](https://github.com/enpaul/tox-poetry-installer/issues/5))
|
||||
- [x] Add trivial tests to ensure the project metadata is consistent between the pyproject.toml
|
||||
and the module constants.
|
||||
- [x] Update to use [poetry-core](https://github.com/python-poetry/poetry-core) and improve
|
||||
robustness of the Tox and Poetry module imports to avoid potentially breaking API changes
|
||||
in upstream packages. ([#2](https://github.com/enpaul/tox-poetry-installer/issues/2))
|
||||
- [ ] ~Add warnings when an unsupported Tox configuration option is detected while using
|
||||
the Poetry backend.~ ([#5](https://github.com/enpaul/tox-poetry-installer/issues/5))
|
||||
- [x] Add trivial tests to ensure the project metadata is consistent between the
|
||||
pyproject.toml and the module constants.
|
||||
- [x] Update to use [poetry-core](https://github.com/python-poetry/poetry-core) and
|
||||
improve robustness of the Tox and Poetry module imports to avoid potentially breaking
|
||||
API changes in upstream packages.
|
||||
([#2](https://github.com/enpaul/tox-poetry-installer/issues/2))
|
||||
- [ ] ~Find and implement a way to mitigate the
|
||||
[UNSAFE_DEPENDENCIES issue](https://github.com/python-poetry/poetry/issues/1584) in
|
||||
Poetry.~ ([#6](https://github.com/enpaul/tox-poetry-installer/issues/6))
|
||||
- [x] Fix logging to make proper use of Tox's logging reporter infrastructure ([#3](https://github.com/enpaul/tox-poetry-installer/issues/3))
|
||||
- [x] Add configuration option for installing all dev-dependencies to a testenv ([#14](https://github.com/enpaul/tox-poetry-installer/issues/14))
|
||||
- [x] Fix logging to make proper use of Tox's logging reporter infrastructure
|
||||
([#3](https://github.com/enpaul/tox-poetry-installer/issues/3))
|
||||
- [x] Add configuration option for installing all dev-dependencies to a testenv
|
||||
([#14](https://github.com/enpaul/tox-poetry-installer/issues/14))
|
||||
|
||||
### Path to Stable
|
||||
|
||||
Everything in Beta plus...
|
||||
|
||||
- [ ] Fully replace dependency on `poetry` with dependency on `poetry-core` ([#2](https://github.com/enpaul/tox-poetry-installer/issues/2))
|
||||
- [ ] Fully replace dependency on `poetry` with dependency on `poetry-core`
|
||||
([#2](https://github.com/enpaul/tox-poetry-installer/issues/2))
|
||||
- [x] Add comprehensive unit tests
|
||||
- [ ] ~Add tests for each feature version of Tox between 3.8 and 3.20~
|
||||
- [x] Add tests for Python-3.6, 3.7, 3.8, and 3.9
|
||||
|
||||
3578
poetry.lock
generated
3578
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "tox-poetry-installer"
|
||||
version = "0.8.4"
|
||||
version = "1.0.0b1"
|
||||
license = "MIT"
|
||||
authors = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]
|
||||
description = "A plugin for Tox that lets you install test environment dependencies from the Poetry lockfile"
|
||||
@@ -23,11 +23,11 @@ classifiers = [
|
||||
"Natural Language :: English",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: Implementation :: CPython",
|
||||
]
|
||||
|
||||
@@ -35,33 +35,34 @@ classifiers = [
|
||||
poetry_installer = "tox_poetry_installer"
|
||||
|
||||
[tool.poetry.extras]
|
||||
poetry = ["poetry"]
|
||||
poetry = ["poetry", "cleo"]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.6.1"
|
||||
poetry = {version = "^1.0.0", optional = true}
|
||||
poetry-core = "^1.0.0"
|
||||
tox = "^3.8.0"
|
||||
python = "^3.7"
|
||||
cleo = {version = ">=1.0,<3.0", optional = true}
|
||||
poetry = {version = "^1.5.0", optional = true}
|
||||
poetry-core = "^1.1.0"
|
||||
tox = "^4"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
bandit = "^1.6.2"
|
||||
black = {version = "^21.12b0", allow-prereleases = true, python = "^3.7"}
|
||||
black = "^22.3.0"
|
||||
blacken-docs = "^1.8.0"
|
||||
ipython = { version = "^7.18.1", python = "^3.7" }
|
||||
mdformat = "^0.6"
|
||||
mdformat-gfm = "^0.2"
|
||||
ipython = {version = "^8.10.1", python = "^3.8"}
|
||||
mdformat = "^0.7"
|
||||
mdformat-gfm = "^0.3"
|
||||
mypy = "^0.930"
|
||||
pre-commit = "^2.7.1"
|
||||
pre-commit-hooks = "^3.3.0"
|
||||
pylint = "^2.4.4"
|
||||
pylint = "^2.13.0"
|
||||
pytest = "^6.0.2"
|
||||
pytest-cov = "^2.10.1"
|
||||
reorder-python-imports = "^2.3.5"
|
||||
safety = "^1.9.0"
|
||||
safety = "^2.2.0"
|
||||
toml = "^0.10.1"
|
||||
tox = "^3.20.0"
|
||||
tox = "^4"
|
||||
types-toml = "^0.10.1"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
requires = ["poetry-core>=1.1.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
# pylint: disable=missing-module-docstring, missing-function-docstring, unused-argument, too-few-public-methods
|
||||
import time
|
||||
from pathlib import Path
|
||||
from typing import List
|
||||
|
||||
import poetry.factory
|
||||
import poetry.installation.pip_installer
|
||||
import poetry.installation.executor
|
||||
import poetry.utils.env
|
||||
import pytest
|
||||
import tox
|
||||
from poetry.core.packages import Package as PoetryPackage
|
||||
import tox.tox_env.python.virtual_env.runner
|
||||
from poetry.installation.operations.operation import Operation
|
||||
|
||||
from tox_poetry_installer import utilities
|
||||
|
||||
@@ -20,11 +21,8 @@ FAKE_VENV_PATH = Path("nowhere")
|
||||
class MockVirtualEnv:
|
||||
"""Mock class for the :class:`poetry.utils.env.VirtualEnv` and :class:`tox.venv.VirtualEnv`"""
|
||||
|
||||
class MockTestenvConfig: # pylint: disable=missing-class-docstring
|
||||
envdir = FAKE_VENV_PATH
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.envconfig = self.MockTestenvConfig()
|
||||
self.env_dir = FAKE_VENV_PATH
|
||||
self.installed = []
|
||||
|
||||
@staticmethod
|
||||
@@ -36,24 +34,24 @@ class MockVirtualEnv:
|
||||
return (1, 2, 3)
|
||||
|
||||
|
||||
class MockPipInstaller:
|
||||
"""Mock class for the :class:`poetry.installation.pip_installer.PipInstaller`"""
|
||||
class MockExecutor:
|
||||
"""Mock class for the :class:`poetry.installation.executor.Executor`"""
|
||||
|
||||
def __init__(self, env: MockVirtualEnv, **kwargs):
|
||||
self.env = env
|
||||
|
||||
def install(self, package: PoetryPackage):
|
||||
self.env.installed.append(package)
|
||||
def execute(self, operations: List[Operation]):
|
||||
self.env.installed.extend([operation.package for operation in operations])
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_venv(monkeypatch):
|
||||
monkeypatch.setattr(utilities, "convert_virtualenv", lambda venv: venv)
|
||||
monkeypatch.setattr(poetry.installation.executor, "Executor", MockExecutor)
|
||||
monkeypatch.setattr(
|
||||
poetry.installation.pip_installer, "PipInstaller", MockPipInstaller
|
||||
tox.tox_env.python.virtual_env.runner, "VirtualEnvRunner", MockVirtualEnv
|
||||
)
|
||||
monkeypatch.setattr(tox.venv, "VirtualEnv", MockVirtualEnv)
|
||||
monkeypatch.setattr(poetry.utils.env, "VirtualEnv", MockVirtualEnv)
|
||||
|
||||
|
||||
|
||||
525
tests/test-project/poetry.lock
generated
525
tests/test-project/poetry.lock
generated
@@ -1,80 +1,109 @@
|
||||
# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.
|
||||
|
||||
[[package]]
|
||||
name = "appdirs"
|
||||
version = "1.4.4"
|
||||
description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
files = [
|
||||
{file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"},
|
||||
{file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "attrs"
|
||||
version = "20.3.0"
|
||||
description = "Classes Without Boilerplate"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
files = [
|
||||
{file = "attrs-20.3.0-py2.py3-none-any.whl", hash = "sha256:31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6"},
|
||||
{file = "attrs-20.3.0.tar.gz", hash = "sha256:832aa3cde19744e49938b91fea06d69ecb9e649c93ba974535d08ad92164f700"},
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface", "furo", "sphinx", "pre-commit"]
|
||||
dev = ["coverage[toml] (>=5.0.2)", "furo", "hypothesis", "pre-commit", "pympler", "pytest (>=4.3.0)", "six", "sphinx", "zope.interface"]
|
||||
docs = ["furo", "sphinx", "zope.interface"]
|
||||
tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface"]
|
||||
tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six"]
|
||||
tests-no-zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six"]
|
||||
|
||||
[[package]]
|
||||
name = "certifi"
|
||||
version = "2020.12.5"
|
||||
description = "Python package for providing Mozilla's CA Bundle."
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
files = [
|
||||
{file = "certifi-2020.12.5-py2.py3-none-any.whl", hash = "sha256:719a74fb9e33b9bd44cc7f3a8d94bc35e4049deebe19ba7d8e108280cfd59830"},
|
||||
{file = "certifi-2020.12.5.tar.gz", hash = "sha256:1a4995114262bffbc2413b159f2a1a480c969de6e6eb13ee966d470af86af59c"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "chardet"
|
||||
version = "4.0.0"
|
||||
description = "Universal encoding detector for Python 2 and 3"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
files = [
|
||||
{file = "chardet-4.0.0-py2.py3-none-any.whl", hash = "sha256:f864054d66fd9118f2e67044ac8981a54775ec5b67aed0441892edb553d21da5"},
|
||||
{file = "chardet-4.0.0.tar.gz", hash = "sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "click"
|
||||
version = "7.1.2"
|
||||
description = "Composable command line interface toolkit"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
files = [
|
||||
{file = "click-7.1.2-py2.py3-none-any.whl", hash = "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"},
|
||||
{file = "click-7.1.2.tar.gz", hash = "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "colorama"
|
||||
version = "0.4.4"
|
||||
description = "Cross-platform colored terminal text."
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
files = [
|
||||
{file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"},
|
||||
{file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "distlib"
|
||||
version = "0.3.1"
|
||||
description = "Distribution utilities"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
files = [
|
||||
{file = "distlib-0.3.1-py2.py3-none-any.whl", hash = "sha256:8c09de2c67b3e7deef7184574fc060ab8a793e7adbb183d942c389c8b13c52fb"},
|
||||
{file = "distlib-0.3.1.zip", hash = "sha256:edf6116872c863e1aa9d5bb7cb5e05a022c519a4594dc703843343a9ddd9bff1"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "filelock"
|
||||
version = "3.0.12"
|
||||
description = "A platform independent file lock."
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
files = [
|
||||
{file = "filelock-3.0.12-py3-none-any.whl", hash = "sha256:929b7d63ec5b7d6b71b0fa5ac14e030b3f70b75747cef1b10da9b879fef15836"},
|
||||
{file = "filelock-3.0.12.tar.gz", hash = "sha256:18d82244ee114f543149c66a6e0c14e9c4f8a1044b5cdaadd0f82159d6a6ff59"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "flask"
|
||||
version = "1.1.2"
|
||||
description = "A simple framework for building complex web applications."
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
files = [
|
||||
{file = "Flask-1.1.2-py2.py3-none-any.whl", hash = "sha256:8a4fdd8936eba2512e9c85df320a37e694c93945b33ef33c89946a340a238557"},
|
||||
{file = "Flask-1.1.2.tar.gz", hash = "sha256:4efa1ae2d7c9865af48986de8aeb8504bf32c7f3d6fdc9353d34b21f4b127060"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
click = ">=5.1"
|
||||
@@ -83,64 +112,79 @@ Jinja2 = ">=2.10.1"
|
||||
Werkzeug = ">=0.15"
|
||||
|
||||
[package.extras]
|
||||
dev = ["pytest", "coverage", "tox", "sphinx", "pallets-sphinx-themes", "sphinxcontrib-log-cabinet", "sphinx-issues"]
|
||||
docs = ["sphinx", "pallets-sphinx-themes", "sphinxcontrib-log-cabinet", "sphinx-issues"]
|
||||
dev = ["coverage", "pallets-sphinx-themes", "pytest", "sphinx", "sphinx-issues", "sphinxcontrib-log-cabinet", "tox"]
|
||||
docs = ["pallets-sphinx-themes", "sphinx", "sphinx-issues", "sphinxcontrib-log-cabinet"]
|
||||
dotenv = ["python-dotenv"]
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "2.10"
|
||||
description = "Internationalized Domain Names in Applications (IDNA)"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
files = [
|
||||
{file = "idna-2.10-py2.py3-none-any.whl", hash = "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"},
|
||||
{file = "idna-2.10.tar.gz", hash = "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "importlib-metadata"
|
||||
version = "3.10.1"
|
||||
description = "Read metadata from Python packages"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
files = [
|
||||
{file = "importlib_metadata-3.10.1-py3-none-any.whl", hash = "sha256:2ec0faae539743ae6aaa84b49a169670a465f7f5d64e6add98388cc29fd1f2f6"},
|
||||
{file = "importlib_metadata-3.10.1.tar.gz", hash = "sha256:c9356b657de65c53744046fa8f7358afe0714a1af7d570c00c3835c2d724a7c1"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""}
|
||||
zipp = ">=0.5"
|
||||
|
||||
[package.extras]
|
||||
docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"]
|
||||
testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "packaging", "pep517", "pyfakefs", "flufl.flake8", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"]
|
||||
docs = ["jaraco.packaging (>=8.2)", "rst.linker (>=1.9)", "sphinx"]
|
||||
testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pep517", "pyfakefs", "pytest (>=4.6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.0.1)", "pytest-flake8", "pytest-mypy"]
|
||||
|
||||
[[package]]
|
||||
name = "importlib-resources"
|
||||
version = "5.1.2"
|
||||
description = "Read resources from Python packages"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
files = [
|
||||
{file = "importlib_resources-5.1.2-py3-none-any.whl", hash = "sha256:ebab3efe74d83b04d6bf5cd9a17f0c5c93e60fb60f30c90f56265fce4682a469"},
|
||||
{file = "importlib_resources-5.1.2.tar.gz", hash = "sha256:642586fc4740bd1cad7690f836b3321309402b20b332529f25617ff18e8e1370"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
zipp = {version = ">=0.4", markers = "python_version < \"3.8\""}
|
||||
|
||||
[package.extras]
|
||||
docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"]
|
||||
testing = ["pytest (>=4.6)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "pytest-enabler", "pytest-black (>=0.3.7)", "pytest-mypy"]
|
||||
docs = ["jaraco.packaging (>=8.2)", "rst.linker (>=1.9)", "sphinx"]
|
||||
testing = ["pytest (>=4.6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=1.2.3)", "pytest-cov", "pytest-enabler", "pytest-flake8", "pytest-mypy"]
|
||||
|
||||
[[package]]
|
||||
name = "itsdangerous"
|
||||
version = "1.1.0"
|
||||
description = "Various helpers to pass data to untrusted environments and back."
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
files = [
|
||||
{file = "itsdangerous-1.1.0-py2.py3-none-any.whl", hash = "sha256:b12271b2047cb23eeb98c8b5622e2e5c5e9abd9784a153e9d8ef9cb4dd09d749"},
|
||||
{file = "itsdangerous-1.1.0.tar.gz", hash = "sha256:321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jinja2"
|
||||
version = "2.11.3"
|
||||
description = "A very fast and expressive template engine."
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
files = [
|
||||
{file = "Jinja2-2.11.3-py2.py3-none-any.whl", hash = "sha256:03e47ad063331dd6a3f04a43eddca8a966a26ba0c5b7207a9a9e4e08f1b29419"},
|
||||
{file = "Jinja2-2.11.3.tar.gz", hash = "sha256:a6d58433de0ae800347cab1fa3043cebbabe8baa9d29e668f1c768cb87a333c6"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
MarkupSafe = ">=0.23"
|
||||
@@ -152,247 +196,9 @@ i18n = ["Babel (>=0.8)"]
|
||||
name = "markupsafe"
|
||||
version = "1.1.1"
|
||||
description = "Safely add untrusted strings to HTML/XML markup."
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*"
|
||||
|
||||
[[package]]
|
||||
name = "packaging"
|
||||
version = "20.9"
|
||||
description = "Core utilities for Python packages"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
|
||||
[package.dependencies]
|
||||
pyparsing = ">=2.0.2"
|
||||
|
||||
[[package]]
|
||||
name = "pluggy"
|
||||
version = "0.13.1"
|
||||
description = "plugin and hook calling mechanisms for python"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
|
||||
[package.dependencies]
|
||||
importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""}
|
||||
|
||||
[package.extras]
|
||||
dev = ["pre-commit", "tox"]
|
||||
|
||||
[[package]]
|
||||
name = "py"
|
||||
version = "1.10.0"
|
||||
description = "library with cross-python path, ini-parsing, io, code, log facilities"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
|
||||
[[package]]
|
||||
name = "pyparsing"
|
||||
version = "2.4.7"
|
||||
description = "Python parsing module"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
|
||||
|
||||
[[package]]
|
||||
name = "python-dateutil"
|
||||
version = "2.8.1"
|
||||
description = "Extensions to the standard Python datetime module"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7"
|
||||
|
||||
[package.dependencies]
|
||||
six = ">=1.5"
|
||||
|
||||
[[package]]
|
||||
name = "requests"
|
||||
version = "2.25.1"
|
||||
description = "Python HTTP for Humans."
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
|
||||
[package.dependencies]
|
||||
certifi = ">=2017.4.17"
|
||||
chardet = ">=3.0.2,<5"
|
||||
idna = ">=2.5,<3"
|
||||
urllib3 = ">=1.21.1,<1.27"
|
||||
|
||||
[package.extras]
|
||||
security = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)"]
|
||||
socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"]
|
||||
|
||||
[[package]]
|
||||
name = "six"
|
||||
version = "1.15.0"
|
||||
description = "Python 2 and 3 compatibility utilities"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.10.2"
|
||||
description = "Python Library for Tom's Obvious, Minimal Language"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
|
||||
|
||||
[[package]]
|
||||
name = "tox"
|
||||
version = "3.23.0"
|
||||
description = "tox is a generic virtualenv management and test command line tool"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7"
|
||||
|
||||
[package.dependencies]
|
||||
colorama = {version = ">=0.4.1", markers = "platform_system == \"Windows\""}
|
||||
filelock = ">=3.0.0"
|
||||
importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""}
|
||||
packaging = ">=14"
|
||||
pluggy = ">=0.12.0"
|
||||
py = ">=1.4.17"
|
||||
six = ">=1.14.0"
|
||||
toml = ">=0.9.4"
|
||||
virtualenv = ">=16.0.0,<20.0.0 || >20.0.0,<20.0.1 || >20.0.1,<20.0.2 || >20.0.2,<20.0.3 || >20.0.3,<20.0.4 || >20.0.4,<20.0.5 || >20.0.5,<20.0.6 || >20.0.6,<20.0.7 || >20.0.7"
|
||||
|
||||
[package.extras]
|
||||
docs = ["pygments-github-lexers (>=0.0.5)", "sphinx (>=2.0.0)", "sphinxcontrib-autoprogram (>=0.1.5)", "towncrier (>=18.5.0)"]
|
||||
testing = ["flaky (>=3.4.0)", "freezegun (>=0.3.11)", "psutil (>=5.6.1)", "pytest (>=4.0.0)", "pytest-cov (>=2.5.1)", "pytest-mock (>=1.10.0)", "pytest-randomly (>=1.0.0)", "pytest-xdist (>=1.22.2)", "pathlib2 (>=2.3.3)"]
|
||||
|
||||
[[package]]
|
||||
name = "typing-extensions"
|
||||
version = "3.7.4.3"
|
||||
description = "Backported and Experimental Type Hints for Python 3.5+"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "urllib3"
|
||||
version = "1.26.4"
|
||||
description = "HTTP library with thread-safe connection pooling, file post, and more."
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4"
|
||||
|
||||
[package.extras]
|
||||
secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"]
|
||||
socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]
|
||||
brotli = ["brotlipy (>=0.6.0)"]
|
||||
|
||||
[[package]]
|
||||
name = "virtualenv"
|
||||
version = "20.4.3"
|
||||
description = "Virtual Python Environment builder"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7"
|
||||
|
||||
[package.dependencies]
|
||||
appdirs = ">=1.4.3,<2"
|
||||
distlib = ">=0.3.1,<1"
|
||||
filelock = ">=3.0.0,<4"
|
||||
importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""}
|
||||
importlib-resources = {version = ">=1.0", markers = "python_version < \"3.7\""}
|
||||
six = ">=1.9.0,<2"
|
||||
|
||||
[package.extras]
|
||||
docs = ["proselint (>=0.10.2)", "sphinx (>=3)", "sphinx-argparse (>=0.2.5)", "sphinx-rtd-theme (>=0.4.3)", "towncrier (>=19.9.0rc1)"]
|
||||
testing = ["coverage (>=4)", "coverage-enable-subprocess (>=1)", "flaky (>=3)", "pytest (>=4)", "pytest-env (>=0.6.2)", "pytest-freezegun (>=0.4.1)", "pytest-mock (>=2)", "pytest-randomly (>=1)", "pytest-timeout (>=1)", "packaging (>=20.0)", "xonsh (>=0.9.16)"]
|
||||
|
||||
[[package]]
|
||||
name = "werkzeug"
|
||||
version = "1.0.1"
|
||||
description = "The comprehensive WSGI web application library."
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
|
||||
[package.extras]
|
||||
dev = ["pytest", "pytest-timeout", "coverage", "tox", "sphinx", "pallets-sphinx-themes", "sphinx-issues"]
|
||||
watchdog = ["watchdog"]
|
||||
|
||||
[[package]]
|
||||
name = "zipp"
|
||||
version = "3.4.1"
|
||||
description = "Backport of pathlib-compatible object wrapper for zip files"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[package.extras]
|
||||
docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"]
|
||||
testing = ["pytest (>=4.6)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "pytest-enabler", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"]
|
||||
|
||||
[metadata]
|
||||
lock-version = "1.1"
|
||||
python-versions = "^3.6.1"
|
||||
content-hash = "af9db950cd722e7dc52b691fb58abc1e22ab48b34ddfe4c5258b3c755a3892fa"
|
||||
|
||||
[metadata.files]
|
||||
appdirs = [
|
||||
{file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"},
|
||||
{file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"},
|
||||
]
|
||||
attrs = [
|
||||
{file = "attrs-20.3.0-py2.py3-none-any.whl", hash = "sha256:31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6"},
|
||||
{file = "attrs-20.3.0.tar.gz", hash = "sha256:832aa3cde19744e49938b91fea06d69ecb9e649c93ba974535d08ad92164f700"},
|
||||
]
|
||||
certifi = [
|
||||
{file = "certifi-2020.12.5-py2.py3-none-any.whl", hash = "sha256:719a74fb9e33b9bd44cc7f3a8d94bc35e4049deebe19ba7d8e108280cfd59830"},
|
||||
{file = "certifi-2020.12.5.tar.gz", hash = "sha256:1a4995114262bffbc2413b159f2a1a480c969de6e6eb13ee966d470af86af59c"},
|
||||
]
|
||||
chardet = [
|
||||
{file = "chardet-4.0.0-py2.py3-none-any.whl", hash = "sha256:f864054d66fd9118f2e67044ac8981a54775ec5b67aed0441892edb553d21da5"},
|
||||
{file = "chardet-4.0.0.tar.gz", hash = "sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa"},
|
||||
]
|
||||
click = [
|
||||
{file = "click-7.1.2-py2.py3-none-any.whl", hash = "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"},
|
||||
{file = "click-7.1.2.tar.gz", hash = "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"},
|
||||
]
|
||||
colorama = [
|
||||
{file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"},
|
||||
{file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"},
|
||||
]
|
||||
distlib = [
|
||||
{file = "distlib-0.3.1-py2.py3-none-any.whl", hash = "sha256:8c09de2c67b3e7deef7184574fc060ab8a793e7adbb183d942c389c8b13c52fb"},
|
||||
{file = "distlib-0.3.1.zip", hash = "sha256:edf6116872c863e1aa9d5bb7cb5e05a022c519a4594dc703843343a9ddd9bff1"},
|
||||
]
|
||||
filelock = [
|
||||
{file = "filelock-3.0.12-py3-none-any.whl", hash = "sha256:929b7d63ec5b7d6b71b0fa5ac14e030b3f70b75747cef1b10da9b879fef15836"},
|
||||
{file = "filelock-3.0.12.tar.gz", hash = "sha256:18d82244ee114f543149c66a6e0c14e9c4f8a1044b5cdaadd0f82159d6a6ff59"},
|
||||
]
|
||||
flask = [
|
||||
{file = "Flask-1.1.2-py2.py3-none-any.whl", hash = "sha256:8a4fdd8936eba2512e9c85df320a37e694c93945b33ef33c89946a340a238557"},
|
||||
{file = "Flask-1.1.2.tar.gz", hash = "sha256:4efa1ae2d7c9865af48986de8aeb8504bf32c7f3d6fdc9353d34b21f4b127060"},
|
||||
]
|
||||
idna = [
|
||||
{file = "idna-2.10-py2.py3-none-any.whl", hash = "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"},
|
||||
{file = "idna-2.10.tar.gz", hash = "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6"},
|
||||
]
|
||||
importlib-metadata = [
|
||||
{file = "importlib_metadata-3.10.1-py3-none-any.whl", hash = "sha256:2ec0faae539743ae6aaa84b49a169670a465f7f5d64e6add98388cc29fd1f2f6"},
|
||||
{file = "importlib_metadata-3.10.1.tar.gz", hash = "sha256:c9356b657de65c53744046fa8f7358afe0714a1af7d570c00c3835c2d724a7c1"},
|
||||
]
|
||||
importlib-resources = [
|
||||
{file = "importlib_resources-5.1.2-py3-none-any.whl", hash = "sha256:ebab3efe74d83b04d6bf5cd9a17f0c5c93e60fb60f30c90f56265fce4682a469"},
|
||||
{file = "importlib_resources-5.1.2.tar.gz", hash = "sha256:642586fc4740bd1cad7690f836b3321309402b20b332529f25617ff18e8e1370"},
|
||||
]
|
||||
itsdangerous = [
|
||||
{file = "itsdangerous-1.1.0-py2.py3-none-any.whl", hash = "sha256:b12271b2047cb23eeb98c8b5622e2e5c5e9abd9784a153e9d8ef9cb4dd09d749"},
|
||||
{file = "itsdangerous-1.1.0.tar.gz", hash = "sha256:321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19"},
|
||||
]
|
||||
jinja2 = [
|
||||
{file = "Jinja2-2.11.3-py2.py3-none-any.whl", hash = "sha256:03e47ad063331dd6a3f04a43eddca8a966a26ba0c5b7207a9a9e4e08f1b29419"},
|
||||
{file = "Jinja2-2.11.3.tar.gz", hash = "sha256:a6d58433de0ae800347cab1fa3043cebbabe8baa9d29e668f1c768cb87a333c6"},
|
||||
]
|
||||
markupsafe = [
|
||||
files = [
|
||||
{file = "MarkupSafe-1.1.1-cp27-cp27m-macosx_10_6_intel.whl", hash = "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161"},
|
||||
{file = "MarkupSafe-1.1.1-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7"},
|
||||
{file = "MarkupSafe-1.1.1-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183"},
|
||||
@@ -446,60 +252,225 @@ markupsafe = [
|
||||
{file = "MarkupSafe-1.1.1-cp39-cp39-win_amd64.whl", hash = "sha256:b7d644ddb4dbd407d31ffb699f1d140bc35478da613b441c582aeb7c43838dd8"},
|
||||
{file = "MarkupSafe-1.1.1.tar.gz", hash = "sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b"},
|
||||
]
|
||||
packaging = [
|
||||
|
||||
[[package]]
|
||||
name = "packaging"
|
||||
version = "20.9"
|
||||
description = "Core utilities for Python packages"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
files = [
|
||||
{file = "packaging-20.9-py2.py3-none-any.whl", hash = "sha256:67714da7f7bc052e064859c05c595155bd1ee9f69f76557e21f051443c20947a"},
|
||||
{file = "packaging-20.9.tar.gz", hash = "sha256:5b327ac1320dc863dca72f4514ecc086f31186744b84a230374cc1fd776feae5"},
|
||||
]
|
||||
pluggy = [
|
||||
|
||||
[package.dependencies]
|
||||
pyparsing = ">=2.0.2"
|
||||
|
||||
[[package]]
|
||||
name = "pluggy"
|
||||
version = "0.13.1"
|
||||
description = "plugin and hook calling mechanisms for python"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
files = [
|
||||
{file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"},
|
||||
{file = "pluggy-0.13.1.tar.gz", hash = "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0"},
|
||||
]
|
||||
py = [
|
||||
|
||||
[package.dependencies]
|
||||
importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""}
|
||||
|
||||
[package.extras]
|
||||
dev = ["pre-commit", "tox"]
|
||||
|
||||
[[package]]
|
||||
name = "py"
|
||||
version = "1.10.0"
|
||||
description = "library with cross-python path, ini-parsing, io, code, log facilities"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
files = [
|
||||
{file = "py-1.10.0-py2.py3-none-any.whl", hash = "sha256:3b80836aa6d1feeaa108e046da6423ab8f6ceda6468545ae8d02d9d58d18818a"},
|
||||
{file = "py-1.10.0.tar.gz", hash = "sha256:21b81bda15b66ef5e1a777a21c4dcd9c20ad3efd0b3f817e7a809035269e1bd3"},
|
||||
]
|
||||
pyparsing = [
|
||||
|
||||
[[package]]
|
||||
name = "pyparsing"
|
||||
version = "2.4.7"
|
||||
description = "Python parsing module"
|
||||
optional = false
|
||||
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
|
||||
files = [
|
||||
{file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"},
|
||||
{file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"},
|
||||
]
|
||||
python-dateutil = [
|
||||
|
||||
[[package]]
|
||||
name = "python-dateutil"
|
||||
version = "2.8.1"
|
||||
description = "Extensions to the standard Python datetime module"
|
||||
optional = false
|
||||
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7"
|
||||
files = [
|
||||
{file = "python-dateutil-2.8.1.tar.gz", hash = "sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c"},
|
||||
{file = "python_dateutil-2.8.1-py2.py3-none-any.whl", hash = "sha256:75bb3f31ea686f1197762692a9ee6a7550b59fc6ca3a1f4b5d7e32fb98e2da2a"},
|
||||
]
|
||||
requests = [
|
||||
|
||||
[package.dependencies]
|
||||
six = ">=1.5"
|
||||
|
||||
[[package]]
|
||||
name = "requests"
|
||||
version = "2.25.1"
|
||||
description = "Python HTTP for Humans."
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
files = [
|
||||
{file = "requests-2.25.1-py2.py3-none-any.whl", hash = "sha256:c210084e36a42ae6b9219e00e48287def368a26d03a048ddad7bfee44f75871e"},
|
||||
{file = "requests-2.25.1.tar.gz", hash = "sha256:27973dd4a904a4f13b263a19c866c13b92a39ed1c964655f025f3f8d3d75b804"},
|
||||
]
|
||||
six = [
|
||||
|
||||
[package.dependencies]
|
||||
certifi = ">=2017.4.17"
|
||||
chardet = ">=3.0.2,<5"
|
||||
idna = ">=2.5,<3"
|
||||
urllib3 = ">=1.21.1,<1.27"
|
||||
|
||||
[package.extras]
|
||||
security = ["cryptography (>=1.3.4)", "pyOpenSSL (>=0.14)"]
|
||||
socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"]
|
||||
|
||||
[[package]]
|
||||
name = "six"
|
||||
version = "1.15.0"
|
||||
description = "Python 2 and 3 compatibility utilities"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
|
||||
files = [
|
||||
{file = "six-1.15.0-py2.py3-none-any.whl", hash = "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"},
|
||||
{file = "six-1.15.0.tar.gz", hash = "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"},
|
||||
]
|
||||
toml = [
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.10.2"
|
||||
description = "Python Library for Tom's Obvious, Minimal Language"
|
||||
optional = false
|
||||
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
|
||||
files = [
|
||||
{file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"},
|
||||
{file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"},
|
||||
]
|
||||
tox = [
|
||||
|
||||
[[package]]
|
||||
name = "tox"
|
||||
version = "3.23.0"
|
||||
description = "tox is a generic virtualenv management and test command line tool"
|
||||
optional = false
|
||||
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7"
|
||||
files = [
|
||||
{file = "tox-3.23.0-py2.py3-none-any.whl", hash = "sha256:e007673f3595cede9b17a7c4962389e4305d4a3682a6c5a4159a1453b4f326aa"},
|
||||
{file = "tox-3.23.0.tar.gz", hash = "sha256:05a4dbd5e4d3d8269b72b55600f0b0303e2eb47ad5c6fe76d3576f4c58d93661"},
|
||||
]
|
||||
typing-extensions = [
|
||||
|
||||
[package.dependencies]
|
||||
colorama = {version = ">=0.4.1", markers = "platform_system == \"Windows\""}
|
||||
filelock = ">=3.0.0"
|
||||
importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""}
|
||||
packaging = ">=14"
|
||||
pluggy = ">=0.12.0"
|
||||
py = ">=1.4.17"
|
||||
six = ">=1.14.0"
|
||||
toml = ">=0.9.4"
|
||||
virtualenv = ">=16.0.0,<20.0.0 || >20.0.0,<20.0.1 || >20.0.1,<20.0.2 || >20.0.2,<20.0.3 || >20.0.3,<20.0.4 || >20.0.4,<20.0.5 || >20.0.5,<20.0.6 || >20.0.6,<20.0.7 || >20.0.7"
|
||||
|
||||
[package.extras]
|
||||
docs = ["pygments-github-lexers (>=0.0.5)", "sphinx (>=2.0.0)", "sphinxcontrib-autoprogram (>=0.1.5)", "towncrier (>=18.5.0)"]
|
||||
testing = ["flaky (>=3.4.0)", "freezegun (>=0.3.11)", "pathlib2 (>=2.3.3)", "psutil (>=5.6.1)", "pytest (>=4.0.0)", "pytest-cov (>=2.5.1)", "pytest-mock (>=1.10.0)", "pytest-randomly (>=1.0.0)", "pytest-xdist (>=1.22.2)"]
|
||||
|
||||
[[package]]
|
||||
name = "typing-extensions"
|
||||
version = "3.7.4.3"
|
||||
description = "Backported and Experimental Type Hints for Python 3.5+"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
files = [
|
||||
{file = "typing_extensions-3.7.4.3-py2-none-any.whl", hash = "sha256:dafc7639cde7f1b6e1acc0f457842a83e722ccca8eef5270af2d74792619a89f"},
|
||||
{file = "typing_extensions-3.7.4.3-py3-none-any.whl", hash = "sha256:7cb407020f00f7bfc3cb3e7881628838e69d8f3fcab2f64742a5e76b2f841918"},
|
||||
{file = "typing_extensions-3.7.4.3.tar.gz", hash = "sha256:99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c"},
|
||||
]
|
||||
urllib3 = [
|
||||
{file = "urllib3-1.26.4-py2.py3-none-any.whl", hash = "sha256:2f4da4594db7e1e110a944bb1b551fdf4e6c136ad42e4234131391e21eb5b0df"},
|
||||
{file = "urllib3-1.26.4.tar.gz", hash = "sha256:e7b021f7241115872f92f43c6508082facffbd1c048e3c6e2bb9c2a157e28937"},
|
||||
|
||||
[[package]]
|
||||
name = "urllib3"
|
||||
version = "1.26.19"
|
||||
description = "HTTP library with thread-safe connection pooling, file post, and more."
|
||||
optional = false
|
||||
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7"
|
||||
files = [
|
||||
{file = "urllib3-1.26.19-py2.py3-none-any.whl", hash = "sha256:37a0344459b199fce0e80b0d3569837ec6b6937435c5244e7fd73fa6006830f3"},
|
||||
{file = "urllib3-1.26.19.tar.gz", hash = "sha256:3e3d753a8618b86d7de333b4223005f68720bcd6a7d2bcb9fbd2229ec7c1e429"},
|
||||
]
|
||||
virtualenv = [
|
||||
|
||||
[package.extras]
|
||||
brotli = ["brotli (==1.0.9)", "brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"]
|
||||
secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "ipaddress", "pyOpenSSL (>=0.14)", "urllib3-secure-extra"]
|
||||
socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]
|
||||
|
||||
[[package]]
|
||||
name = "virtualenv"
|
||||
version = "20.4.3"
|
||||
description = "Virtual Python Environment builder"
|
||||
optional = false
|
||||
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7"
|
||||
files = [
|
||||
{file = "virtualenv-20.4.3-py2.py3-none-any.whl", hash = "sha256:83f95875d382c7abafe06bd2a4cdd1b363e1bb77e02f155ebe8ac082a916b37c"},
|
||||
{file = "virtualenv-20.4.3.tar.gz", hash = "sha256:49ec4eb4c224c6f7dd81bb6d0a28a09ecae5894f4e593c89b0db0885f565a107"},
|
||||
]
|
||||
werkzeug = [
|
||||
|
||||
[package.dependencies]
|
||||
appdirs = ">=1.4.3,<2"
|
||||
distlib = ">=0.3.1,<1"
|
||||
filelock = ">=3.0.0,<4"
|
||||
importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""}
|
||||
importlib-resources = {version = ">=1.0", markers = "python_version < \"3.7\""}
|
||||
six = ">=1.9.0,<2"
|
||||
|
||||
[package.extras]
|
||||
docs = ["proselint (>=0.10.2)", "sphinx (>=3)", "sphinx-argparse (>=0.2.5)", "sphinx-rtd-theme (>=0.4.3)", "towncrier (>=19.9.0rc1)"]
|
||||
testing = ["coverage (>=4)", "coverage-enable-subprocess (>=1)", "flaky (>=3)", "packaging (>=20.0)", "pytest (>=4)", "pytest-env (>=0.6.2)", "pytest-freezegun (>=0.4.1)", "pytest-mock (>=2)", "pytest-randomly (>=1)", "pytest-timeout (>=1)", "xonsh (>=0.9.16)"]
|
||||
|
||||
[[package]]
|
||||
name = "werkzeug"
|
||||
version = "1.0.1"
|
||||
description = "The comprehensive WSGI web application library."
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
files = [
|
||||
{file = "Werkzeug-1.0.1-py2.py3-none-any.whl", hash = "sha256:2de2a5db0baeae7b2d2664949077c2ac63fbd16d98da0ff71837f7d1dea3fd43"},
|
||||
{file = "Werkzeug-1.0.1.tar.gz", hash = "sha256:6c80b1e5ad3665290ea39320b91e1be1e0d5f60652b964a3070216de83d2e47c"},
|
||||
]
|
||||
zipp = [
|
||||
|
||||
[package.extras]
|
||||
dev = ["coverage", "pallets-sphinx-themes", "pytest", "pytest-timeout", "sphinx", "sphinx-issues", "tox"]
|
||||
watchdog = ["watchdog"]
|
||||
|
||||
[[package]]
|
||||
name = "zipp"
|
||||
version = "3.4.1"
|
||||
description = "Backport of pathlib-compatible object wrapper for zip files"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
files = [
|
||||
{file = "zipp-3.4.1-py3-none-any.whl", hash = "sha256:51cb66cc54621609dd593d1787f286ee42a5c0adbb4b29abea5a63edc3e03098"},
|
||||
{file = "zipp-3.4.1.tar.gz", hash = "sha256:3607921face881ba3e026887d8150cca609d517579abe052ac81fc5aeffdbd76"},
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
docs = ["jaraco.packaging (>=8.2)", "rst.linker (>=1.9)", "sphinx"]
|
||||
testing = ["func-timeout", "jaraco.itertools", "pytest (>=4.6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=1.2.3)", "pytest-cov", "pytest-enabler", "pytest-flake8", "pytest-mypy"]
|
||||
|
||||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = "^3.6.1"
|
||||
content-hash = "af9db950cd722e7dc52b691fb58abc1e22ab48b34ddfe4c5258b3c755a3892fa"
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
# pylint: disable=missing-module-docstring, redefined-outer-name, unused-argument, wrong-import-order, unused-import
|
||||
import time
|
||||
from unittest import mock
|
||||
|
||||
import tox.venv
|
||||
import pytest
|
||||
import tox.tox_env.python.virtual_env.runner
|
||||
from poetry.factory import Factory
|
||||
|
||||
from .fixtures import mock_poetry_factory
|
||||
@@ -14,10 +16,10 @@ def test_deduplication(mock_venv, mock_poetry_factory):
|
||||
"""Test that the installer does not install duplicate dependencies"""
|
||||
poetry = Factory().create_poetry(None)
|
||||
packages: utilities.PackageMap = {
|
||||
item.name: item for item in poetry.locker.locked_repository(False).packages
|
||||
item.name: item for item in poetry.locker.locked_repository().packages
|
||||
}
|
||||
|
||||
venv = tox.venv.VirtualEnv()
|
||||
venv = tox.tox_env.python.virtual_env.runner.VirtualEnvRunner()
|
||||
to_install = [packages["toml"], packages["toml"]]
|
||||
|
||||
installer.install(poetry, venv, to_install)
|
||||
@@ -29,7 +31,7 @@ def test_parallelization(mock_venv, mock_poetry_factory):
|
||||
"""Test that behavior is consistent between parallel and non-parallel usage"""
|
||||
poetry = Factory().create_poetry(None)
|
||||
packages: utilities.PackageMap = {
|
||||
item.name: item for item in poetry.locker.locked_repository(False).packages
|
||||
item.name: item for item in poetry.locker.locked_repository().packages
|
||||
}
|
||||
|
||||
to_install = [
|
||||
@@ -41,12 +43,12 @@ def test_parallelization(mock_venv, mock_poetry_factory):
|
||||
packages["attrs"],
|
||||
]
|
||||
|
||||
venv_sequential = tox.venv.VirtualEnv()
|
||||
venv_sequential = tox.tox_env.python.virtual_env.runner.VirtualEnvRunner()
|
||||
start_sequential = time.time()
|
||||
installer.install(poetry, venv_sequential, to_install, 0)
|
||||
sequential = time.time() - start_sequential
|
||||
|
||||
venv_parallel = tox.venv.VirtualEnv()
|
||||
venv_parallel = tox.tox_env.python.virtual_env.runner.VirtualEnvRunner()
|
||||
start_parallel = time.time()
|
||||
installer.install(poetry, venv_parallel, to_install, 5)
|
||||
parallel = time.time() - start_parallel
|
||||
@@ -57,3 +59,32 @@ def test_parallelization(mock_venv, mock_poetry_factory):
|
||||
assert round(parallel * 5) == round(sequential)
|
||||
assert round(sequential) == len(set(to_install))
|
||||
assert round(parallel * 5) == len(set(to_install))
|
||||
|
||||
|
||||
@pytest.mark.parametrize("num_threads", (0, 8))
|
||||
def test_propagates_exceptions_during_installation(
|
||||
mock_venv, mock_poetry_factory, num_threads
|
||||
):
|
||||
"""Assert that an exception which occurs during installation is properly raised.
|
||||
|
||||
Regression test for https://github.com/enpaul/tox-poetry-installer/issues/86
|
||||
"""
|
||||
from tox_poetry_installer import _poetry # pylint: disable=import-outside-toplevel
|
||||
|
||||
poetry = Factory().create_poetry(None)
|
||||
packages: utilities.PackageMap = {
|
||||
item.name: item for item in poetry.locker.locked_repository().packages
|
||||
}
|
||||
to_install = [packages["toml"]]
|
||||
venv = tox.tox_env.python.virtual_env.runner.VirtualEnvRunner()
|
||||
fake_exception = ValueError("my testing exception")
|
||||
|
||||
with mock.patch.object(
|
||||
_poetry,
|
||||
"Executor",
|
||||
**{"return_value.execute.side_effect": fake_exception},
|
||||
):
|
||||
with pytest.raises(ValueError) as exc_info:
|
||||
installer.install(poetry, venv, to_install, num_threads)
|
||||
|
||||
assert exc_info.value is fake_exception
|
||||
|
||||
16
tox.ini
16
tox.ini
@@ -1,6 +1,5 @@
|
||||
[tox]
|
||||
envlist = py36, py37, py38, py39, py310, static, static-tests, security
|
||||
isolated_build = true
|
||||
envlist = py37, py38, py39, py310, py311, static, static-tests, security
|
||||
skip_missing_interpreters = true
|
||||
|
||||
[testenv]
|
||||
@@ -21,7 +20,7 @@ commands =
|
||||
|
||||
[testenv:static]
|
||||
description = Static formatting and quality enforcement
|
||||
basepython = python3.8
|
||||
basepython = py310
|
||||
platform = linux
|
||||
ignore_errors = true
|
||||
locked_deps =
|
||||
@@ -46,7 +45,7 @@ commands =
|
||||
|
||||
[testenv:static-tests]
|
||||
description = Static formatting and quality enforcement for the tests
|
||||
basepython = python3.8
|
||||
basepython = py310
|
||||
platform = linux
|
||||
ignore_errors = true
|
||||
locked_deps =
|
||||
@@ -63,7 +62,7 @@ commands =
|
||||
|
||||
[testenv:security]
|
||||
description = Security checks
|
||||
basepython = python3.8
|
||||
basepython = py310
|
||||
platform = linux
|
||||
ignore_errors = true
|
||||
skip_install = true
|
||||
@@ -83,7 +82,10 @@ commands =
|
||||
--format requirements.txt \
|
||||
--output {envtmpdir}/requirements.txt \
|
||||
--without-hashes \
|
||||
--dev
|
||||
--with dev \
|
||||
--extras poetry
|
||||
safety check \
|
||||
--file {envtmpdir}/requirements.txt \
|
||||
--json
|
||||
--output text \
|
||||
# https://github.com/pytest-dev/py/issues/287
|
||||
--ignore 51457
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# pylint: disable=missing-docstring
|
||||
__title__ = "tox-poetry-installer"
|
||||
__summary__ = "A plugin for Tox that lets you install test environment dependencies from the Poetry lockfile"
|
||||
__version__ = "0.8.4"
|
||||
__version__ = "1.0.0b1"
|
||||
__url__ = "https://github.com/enpaul/tox-poetry-installer/"
|
||||
__license__ = "MIT"
|
||||
__authors__ = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# pylint: disable=missing-docstring
|
||||
from tox_poetry_installer.hooks import tox_addoption
|
||||
from tox_poetry_installer.hooks import tox_testenv_install_deps
|
||||
from tox_poetry_installer.hooks import tox_add_env_config
|
||||
from tox_poetry_installer.hooks import tox_add_option
|
||||
from tox_poetry_installer.hooks import tox_on_install
|
||||
|
||||
@@ -28,9 +28,13 @@ from tox_poetry_installer import exceptions
|
||||
|
||||
|
||||
try:
|
||||
from cleo.io.null_io import NullIO
|
||||
from poetry.config.config import Config
|
||||
from poetry.core.packages.dependency import Dependency as PoetryDependency
|
||||
from poetry.core.packages.package import Package as PoetryPackage
|
||||
from poetry.factory import Factory
|
||||
from poetry.installation.pip_installer import PipInstaller
|
||||
from poetry.io.null_io import NullIO
|
||||
from poetry.installation.executor import Executor
|
||||
from poetry.installation.operations.install import Install
|
||||
from poetry.poetry import Poetry
|
||||
from poetry.utils.env import VirtualEnv
|
||||
except ImportError:
|
||||
|
||||
@@ -20,7 +20,8 @@ PEP508_VERSION_DELIMITERS: Tuple[str, ...] = ("~=", "==", "!=", ">", "<")
|
||||
REPORTER_PREFIX: str = f"{__about__.__title__}:"
|
||||
|
||||
# Internal list of packages that poetry has deemed unsafe and are excluded from the lockfile
|
||||
UNSAFE_PACKAGES: Set[str] = {"distribute", "pip", "setuptools", "wheel"}
|
||||
# TODO: This functionality is no longer needed, should remove in a future update.
|
||||
UNSAFE_PACKAGES: Set[str] = set()
|
||||
|
||||
# Number of threads to use for installing dependencies by default
|
||||
DEFAULT_INSTALL_THREADS: int = 10
|
||||
|
||||
@@ -4,14 +4,14 @@ All implementations of tox hooks are defined here, as well as any single-use hel
|
||||
specifically related to implementing the hooks (to keep the size/readability of the hook functions
|
||||
themselves manageable).
|
||||
"""
|
||||
from typing import Optional
|
||||
from itertools import chain
|
||||
from typing import List
|
||||
|
||||
import tox
|
||||
from tox.action import Action as ToxAction
|
||||
from tox.config import Parser as ToxParser
|
||||
from tox.venv import VirtualEnv as ToxVirtualEnv
|
||||
from tox.config.cli.parser import ToxParser
|
||||
from tox.config.sets import EnvConfigSet
|
||||
from tox.plugin import impl
|
||||
from tox.tox_env.api import ToxEnv as ToxVirtualEnv
|
||||
|
||||
from tox_poetry_installer import __about__
|
||||
from tox_poetry_installer import constants
|
||||
from tox_poetry_installer import exceptions
|
||||
from tox_poetry_installer import installer
|
||||
@@ -19,74 +19,9 @@ from tox_poetry_installer import logger
|
||||
from tox_poetry_installer import utilities
|
||||
|
||||
|
||||
def _postprocess_install_project_deps(
|
||||
testenv_config, value: Optional[str] # pylint: disable=unused-argument
|
||||
) -> Optional[bool]:
|
||||
"""An awful hack to patch on three-state boolean logic to a config parameter
|
||||
|
||||
.. warning: This logic should 100% be removed in the next feature release. It's here to work
|
||||
around a bad design for now but should not persist.
|
||||
|
||||
The bug filed in `#61`_ is caused by a combination of poor design and attempted cleverness. The
|
||||
name of the ``install_project_deps`` config option implies that it has ultimate control over
|
||||
whether the project dependencies are installed to the testenv, but this is not actually correct.
|
||||
What it actually allows the user to do is force the project dependencies to not be installed to
|
||||
an environment that would otherwise install them. This was intended behavior, however the
|
||||
intention was wrong.
|
||||
|
||||
.. _`#61`: https://github.com/enpaul/tox-poetry-installer/issues/61
|
||||
|
||||
In an effort to be clever the plugin automatically skips installing project dependencies when
|
||||
the project package is not installed to the testenv (``skip_install = true``) or if packaging
|
||||
as a whole is disabled (``skipsdist = true``). The intention of this behavior is to install only
|
||||
the expected dependencies to a testenv and no more. However, this conflicts with the
|
||||
``install_project_deps`` config option, which cannot override this behavior because it defaults
|
||||
to ``True``. In effect, ``install_project_deps = true`` in fact means "automatically
|
||||
determine whether to install project dependencies" and ``install_project_deps = false`` means
|
||||
"never install the project dependencies". This is not ideal and unintuitive.
|
||||
|
||||
To avoid having to make a breaking change this workaround has been added to support three-state
|
||||
logic between ``True``, ``False``, and ``None``. The ``install_project_deps`` option is now
|
||||
parsed by Tox as a string with a default value of ``None``. If the value is not ``None`` then
|
||||
this post processing function will try to convert it to a boolean the same way that Tox's
|
||||
`SectionReader.getbool()`_ method does, raising an error to mimic the default behavior if it
|
||||
can't.
|
||||
|
||||
.. _`SectionReader.getbool()`: https://github.com/tox-dev/tox/blob/f8459218ee5ab5753321b3eb989b7beee5b391ad/src/tox/config/__init__.py#L1724
|
||||
|
||||
The three states for the ``install_project_deps`` setting are:
|
||||
* ``None`` - User did not configure the setting, package dependency installation is
|
||||
determined automatically
|
||||
* ``True`` - User configured the setting to ``True``, package dependencies will be installed
|
||||
* ``False`` - User configured the setting to ``False``, package dependencies will not be
|
||||
installed
|
||||
|
||||
This config option should be deprecated with the 1.0.0 release and instead an option like
|
||||
``always_install_project_deps`` should be added which overrides the default determination and
|
||||
just installs the project dependencies. The counterpart (``never_install_project_deps``)
|
||||
shouldn't be needed, since I don't think there's a real use case for that.
|
||||
"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if value.lower() == "true":
|
||||
return True
|
||||
if value.lower() == "false":
|
||||
return False
|
||||
|
||||
raise tox.exception.ConfigError(
|
||||
f"install_project_deps: boolean value '{value}' needs to be 'True' or 'False'"
|
||||
)
|
||||
|
||||
|
||||
@tox.hookimpl
|
||||
def tox_addoption(parser: ToxParser):
|
||||
"""Add required configuration options to the tox INI file
|
||||
|
||||
Adds the ``require_locked_deps`` configuration option to the venv to check whether all
|
||||
dependencies should be treated as locked or not.
|
||||
"""
|
||||
|
||||
@impl
|
||||
def tox_add_option(parser: ToxParser):
|
||||
"""Add additional command line arguments to tox to configure plugin behavior"""
|
||||
parser.add_argument(
|
||||
"--require-poetry",
|
||||
action="store_true",
|
||||
@@ -94,14 +29,6 @@ def tox_addoption(parser: ToxParser):
|
||||
help="(deprecated) Trigger a failure if Poetry is not available to Tox",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--parallelize-locked-install",
|
||||
type=int,
|
||||
dest="parallelize_locked_install",
|
||||
default=None,
|
||||
help="(deprecated) Number of worker threads to use for installing dependencies from the Poetry lockfile in parallel",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--parallel-install-threads",
|
||||
type=int,
|
||||
@@ -110,44 +37,50 @@ def tox_addoption(parser: ToxParser):
|
||||
help="Number of locked dependencies to install simultaneously; set to 0 to disable parallel installation",
|
||||
)
|
||||
|
||||
parser.add_testenv_attribute(
|
||||
name="install_dev_deps",
|
||||
type="bool",
|
||||
|
||||
@impl
|
||||
def tox_add_env_config(env_conf: EnvConfigSet):
|
||||
"""Add required env configuration options to the tox INI file"""
|
||||
env_conf.add_config(
|
||||
"poetry_dep_groups",
|
||||
of_type=List[str],
|
||||
default=[],
|
||||
desc="List of Poetry dependency groups to install to the environment",
|
||||
)
|
||||
|
||||
env_conf.add_config(
|
||||
"install_project_deps",
|
||||
of_type=bool,
|
||||
default=True,
|
||||
desc="Automatically install all Poetry primary dependencies to the environment",
|
||||
)
|
||||
|
||||
env_conf.add_config(
|
||||
"require_locked_deps",
|
||||
of_type=bool,
|
||||
default=False,
|
||||
help="Automatically install all Poetry development dependencies to the environment",
|
||||
desc="Require all dependencies in the environment be installed using the Poetry lockfile",
|
||||
)
|
||||
|
||||
parser.add_testenv_attribute(
|
||||
name="install_project_deps",
|
||||
type="string",
|
||||
default=None,
|
||||
help="Automatically install all Poetry primary dependencies to the environment",
|
||||
postprocess=_postprocess_install_project_deps,
|
||||
)
|
||||
|
||||
parser.add_testenv_attribute(
|
||||
name="require_locked_deps",
|
||||
type="bool",
|
||||
env_conf.add_config(
|
||||
"require_poetry",
|
||||
of_type=bool,
|
||||
default=False,
|
||||
help="Require all dependencies in the environment be installed using the Poetry lockfile",
|
||||
desc="Trigger a failure if Poetry is not available to Tox",
|
||||
)
|
||||
|
||||
parser.add_testenv_attribute(
|
||||
name="require_poetry",
|
||||
type="bool",
|
||||
default=False,
|
||||
help="Trigger a failure if Poetry is not available to Tox",
|
||||
)
|
||||
|
||||
parser.add_testenv_attribute(
|
||||
name="locked_deps",
|
||||
type="line-list",
|
||||
help="List of locked dependencies to install to the environment using the Poetry lockfile",
|
||||
env_conf.add_config(
|
||||
"locked_deps",
|
||||
of_type=List[str],
|
||||
default=[],
|
||||
desc="List of locked dependencies to install to the environment using the Poetry lockfile",
|
||||
)
|
||||
|
||||
|
||||
@tox.hookimpl
|
||||
def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction) -> Optional[bool]:
|
||||
@impl
|
||||
def tox_on_install(
|
||||
tox_env: ToxVirtualEnv, section: str # pylint: disable=unused-argument
|
||||
) -> None:
|
||||
"""Install the dependencies for the current environment
|
||||
|
||||
Loads the local Poetry environment and the corresponding lockfile then pulls the dependencies
|
||||
@@ -157,22 +90,21 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction) -> Optional
|
||||
:param venv: Tox virtual environment object with configuration for the local Tox environment.
|
||||
:param action: Tox action object
|
||||
"""
|
||||
|
||||
try:
|
||||
poetry = utilities.check_preconditions(venv, action)
|
||||
poetry = utilities.check_preconditions(tox_env)
|
||||
except exceptions.SkipEnvironment as err:
|
||||
if isinstance(err, exceptions.PoetryNotInstalledError) and (
|
||||
venv.envconfig.config.option.require_poetry or venv.envconfig.require_poetry
|
||||
if (
|
||||
isinstance(err, exceptions.PoetryNotInstalledError)
|
||||
and tox_env.conf["require_poetry"]
|
||||
):
|
||||
venv.status = err.__class__.__name__
|
||||
logger.error(str(err))
|
||||
return False
|
||||
raise err
|
||||
logger.info(str(err))
|
||||
return None
|
||||
return
|
||||
|
||||
logger.info(f"Loaded project pyproject.toml from {poetry.file}")
|
||||
|
||||
virtualenv = utilities.convert_virtualenv(venv)
|
||||
virtualenv = utilities.convert_virtualenv(tox_env)
|
||||
|
||||
if not poetry.locker.is_fresh():
|
||||
logger.warning(
|
||||
@@ -180,41 +112,44 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction) -> Optional
|
||||
)
|
||||
|
||||
try:
|
||||
if venv.envconfig.require_locked_deps and venv.envconfig.deps:
|
||||
if tox_env.conf["require_locked_deps"] and tox_env.conf["deps"].lines():
|
||||
raise exceptions.LockedDepsRequiredError(
|
||||
f"Unlocked dependencies '{venv.envconfig.deps}' specified for environment '{venv.name}' which requires locked dependencies"
|
||||
f"Unlocked dependencies '{tox_env.conf['deps']}' specified for environment '{tox_env.name}' which requires locked dependencies"
|
||||
)
|
||||
|
||||
packages = utilities.build_package_map(poetry)
|
||||
|
||||
if venv.envconfig.install_dev_deps:
|
||||
dev_deps = utilities.find_dev_deps(packages, virtualenv, poetry)
|
||||
logger.info(
|
||||
f"Identified {len(dev_deps)} development dependencies to install to env"
|
||||
group_deps = utilities.dedupe_packages(
|
||||
list(
|
||||
chain(
|
||||
*[
|
||||
utilities.find_group_deps(group, packages, virtualenv, poetry)
|
||||
for group in tox_env.conf["poetry_dep_groups"]
|
||||
]
|
||||
)
|
||||
)
|
||||
else:
|
||||
dev_deps = []
|
||||
logger.info("Env does not install development dependencies, skipping")
|
||||
)
|
||||
logger.info(
|
||||
f"Identified {len(group_deps)} group dependencies to install to env"
|
||||
)
|
||||
|
||||
env_deps = utilities.find_additional_deps(
|
||||
packages, virtualenv, poetry, venv.envconfig.locked_deps
|
||||
packages, virtualenv, poetry, tox_env.conf["locked_deps"]
|
||||
)
|
||||
|
||||
logger.info(
|
||||
f"Identified {len(env_deps)} environment dependencies to install to env"
|
||||
)
|
||||
|
||||
install_project_deps = (
|
||||
venv.envconfig.install_project_deps
|
||||
if venv.envconfig.install_project_deps is not None
|
||||
else (
|
||||
not venv.envconfig.skip_install and not venv.envconfig.config.skipsdist
|
||||
)
|
||||
)
|
||||
# extras are not set in a testenv if skip_install=true
|
||||
try:
|
||||
extras = tox_env.conf["extras"]
|
||||
except KeyError:
|
||||
extras = []
|
||||
|
||||
if install_project_deps:
|
||||
if tox_env.conf["install_project_deps"]:
|
||||
project_deps = utilities.find_project_deps(
|
||||
packages, virtualenv, poetry, venv.envconfig.extras
|
||||
packages, virtualenv, poetry, extras
|
||||
)
|
||||
logger.info(
|
||||
f"Identified {len(project_deps)} project dependencies to install to env"
|
||||
@@ -223,37 +158,18 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction) -> Optional
|
||||
project_deps = []
|
||||
logger.info("Env does not install project package dependencies, skipping")
|
||||
except exceptions.ToxPoetryInstallerException as err:
|
||||
venv.status = err.__class__.__name__
|
||||
logger.error(str(err))
|
||||
return False
|
||||
raise err
|
||||
except Exception as err:
|
||||
venv.status = "InternalError"
|
||||
logger.error(f"Internal plugin error: {err}")
|
||||
raise err
|
||||
|
||||
dependencies = dev_deps + env_deps + project_deps
|
||||
if (
|
||||
venv.envconfig.config.option.parallel_install_threads
|
||||
!= constants.DEFAULT_INSTALL_THREADS
|
||||
):
|
||||
parallel_threads = venv.envconfig.config.option.parallel_install_threads
|
||||
else:
|
||||
parallel_threads = (
|
||||
venv.envconfig.config.option.parallelize_locked_install
|
||||
if venv.envconfig.config.option.parallelize_locked_install is not None
|
||||
else constants.DEFAULT_INSTALL_THREADS
|
||||
)
|
||||
log_parallel = f" (using {parallel_threads} threads)" if parallel_threads else ""
|
||||
dependencies = utilities.dedupe_packages(group_deps + env_deps + project_deps)
|
||||
|
||||
action.setactivity(
|
||||
__about__.__title__,
|
||||
f"Installing {len(dependencies)} dependencies from Poetry lock file{log_parallel}",
|
||||
)
|
||||
logger.info(f"Installing {len(dependencies)} dependencies from Poetry lock file")
|
||||
installer.install(
|
||||
poetry,
|
||||
venv,
|
||||
tox_env,
|
||||
dependencies,
|
||||
parallel_threads,
|
||||
tox_env.options.parallel_install_threads,
|
||||
)
|
||||
|
||||
return venv.envconfig.require_locked_deps or None
|
||||
|
||||
@@ -6,11 +6,10 @@ import concurrent.futures
|
||||
import contextlib
|
||||
import typing
|
||||
from datetime import datetime
|
||||
from typing import Sequence
|
||||
from typing import Collection
|
||||
from typing import Set
|
||||
|
||||
from poetry.core.packages import Package as PoetryPackage
|
||||
from tox.venv import VirtualEnv as ToxVirtualEnv
|
||||
from tox.tox_env.api import ToxEnv as ToxVirtualEnv
|
||||
|
||||
from tox_poetry_installer import logger
|
||||
from tox_poetry_installer import utilities
|
||||
@@ -22,7 +21,7 @@ if typing.TYPE_CHECKING:
|
||||
def install(
|
||||
poetry: "_poetry.Poetry",
|
||||
venv: ToxVirtualEnv,
|
||||
packages: Sequence[PoetryPackage],
|
||||
packages: Collection["_poetry.PoetryPackage"],
|
||||
parallels: int = 0,
|
||||
):
|
||||
"""Install a bunch of packages to a virtualenv
|
||||
@@ -35,22 +34,21 @@ def install(
|
||||
"""
|
||||
from tox_poetry_installer import _poetry
|
||||
|
||||
logger.info(
|
||||
f"Installing {len(packages)} packages to environment at {venv.envconfig.envdir}"
|
||||
)
|
||||
logger.info(f"Installing {len(packages)} packages to environment at {venv.env_dir}")
|
||||
|
||||
pip = _poetry.PipInstaller(
|
||||
install_executor = _poetry.Executor(
|
||||
env=utilities.convert_virtualenv(venv),
|
||||
io=_poetry.NullIO(),
|
||||
pool=poetry.pool,
|
||||
config=_poetry.Config(),
|
||||
)
|
||||
|
||||
installed: Set[PoetryPackage] = set()
|
||||
installed: Set[_poetry.PoetryPackage] = set()
|
||||
|
||||
def logged_install(dependency: PoetryPackage) -> None:
|
||||
def logged_install(dependency: _poetry.PoetryPackage) -> None:
|
||||
start = datetime.now()
|
||||
logger.debug(f"Installing {dependency}")
|
||||
pip.install(dependency)
|
||||
install_executor.execute([_poetry.Install(package=dependency)])
|
||||
end = datetime.now()
|
||||
logger.debug(f"Finished installing {dependency} in {end - start}")
|
||||
|
||||
@@ -71,11 +69,20 @@ def install(
|
||||
yield lambda func, arg: func(arg)
|
||||
|
||||
with _optional_parallelize() as executor:
|
||||
futures = []
|
||||
for dependency in packages:
|
||||
if dependency not in installed:
|
||||
installed.add(dependency)
|
||||
logger.debug(f"Queuing {dependency}")
|
||||
executor(logged_install, dependency)
|
||||
future = executor(logged_install, dependency)
|
||||
if future is not None:
|
||||
futures.append(future)
|
||||
else:
|
||||
logger.debug(f"Skipping {dependency}, already installed")
|
||||
logger.debug("Waiting for installs to finish...")
|
||||
|
||||
for future in concurrent.futures.as_completed(futures):
|
||||
# Don't actually care about the return value, just waiting on the
|
||||
# future to ensure any exceptions that were raised in the called
|
||||
# function are propagated.
|
||||
future.result()
|
||||
|
||||
@@ -4,26 +4,26 @@ Calling ``tox.reporter.something()`` and having to format a string with the pref
|
||||
gets really old fast, but more importantly it also makes the flow of the main code
|
||||
more difficult to follow because of the added complexity.
|
||||
"""
|
||||
import tox
|
||||
import logging
|
||||
|
||||
from tox_poetry_installer import constants
|
||||
|
||||
|
||||
def error(message: str):
|
||||
"""Wrapper around :func:`tox.reporter.error`"""
|
||||
tox.reporter.error(f"{constants.REPORTER_PREFIX} {message}")
|
||||
"""Wrapper around :func:`logging.error` that prefixes the reporter prefix onto the message"""
|
||||
logging.error(f"{constants.REPORTER_PREFIX} {message}")
|
||||
|
||||
|
||||
def warning(message: str):
|
||||
"""Wrapper around :func:`tox.reporter.warning`"""
|
||||
tox.reporter.warning(f"{constants.REPORTER_PREFIX} {message}")
|
||||
"""Wrapper around :func:`logging.warning`"""
|
||||
logging.warning(f"{constants.REPORTER_PREFIX} {message}")
|
||||
|
||||
|
||||
def info(message: str):
|
||||
"""Wrapper around :func:`tox.reporter.verbosity1`"""
|
||||
tox.reporter.verbosity1(f"{constants.REPORTER_PREFIX} {message}")
|
||||
"""Wrapper around :func:`logging.info`"""
|
||||
logging.info(f"{constants.REPORTER_PREFIX} {message}")
|
||||
|
||||
|
||||
def debug(message: str):
|
||||
"""Wrapper around :func:`tox.reporter.verbosity2`"""
|
||||
tox.reporter.verbosity2(f"{constants.REPORTER_PREFIX} {message}")
|
||||
"""Wrapper around :func:`logging.debug`"""
|
||||
logging.debug(f"{constants.REPORTER_PREFIX} {message}")
|
||||
|
||||
@@ -10,10 +10,10 @@ from typing import List
|
||||
from typing import Sequence
|
||||
from typing import Set
|
||||
|
||||
from poetry.core.packages import Dependency as PoetryDependency
|
||||
from poetry.core.packages import Package as PoetryPackage
|
||||
from tox.action import Action as ToxAction
|
||||
from tox.venv import VirtualEnv as ToxVirtualEnv
|
||||
from poetry.core.packages.dependency import Dependency as PoetryDependency
|
||||
from poetry.core.packages.package import Package as PoetryPackage
|
||||
from tox.tox_env.api import ToxEnv as ToxVirtualEnv
|
||||
from tox.tox_env.package import PackageToxEnv
|
||||
|
||||
from tox_poetry_installer import constants
|
||||
from tox_poetry_installer import exceptions
|
||||
@@ -26,43 +26,28 @@ if typing.TYPE_CHECKING:
|
||||
PackageMap = Dict[str, List[PoetryPackage]]
|
||||
|
||||
|
||||
def check_preconditions(venv: ToxVirtualEnv, action: ToxAction) -> "_poetry.Poetry":
|
||||
def check_preconditions(venv: ToxVirtualEnv) -> "_poetry.Poetry":
|
||||
"""Check that the local project environment meets expectations"""
|
||||
|
||||
# Skip running the plugin for the provisioning environment. The provisioned environment,
|
||||
# for alternative Tox versions and/or the ``requires`` meta dependencies is specially
|
||||
# handled by Tox and is out of scope for this plugin. Since one of the ways to install this
|
||||
# plugin in the first place is via the Tox provisioning environment, it quickly becomes a
|
||||
# chicken-and-egg problem.
|
||||
if action.name == venv.envconfig.config.provision_tox_env:
|
||||
raise exceptions.SkipEnvironment(
|
||||
f"Skipping Tox provisioning env '{action.name}'"
|
||||
)
|
||||
if isinstance(venv, PackageToxEnv):
|
||||
raise exceptions.SkipEnvironment(f"Skipping Tox provisioning env '{venv.name}'")
|
||||
|
||||
# Skip running the plugin for the packaging environment. PEP-517 front ends can handle
|
||||
# that better than we can, so let them do their thing. More to the point: if you're having
|
||||
# problems in the packaging env that this plugin would solve, god help you.
|
||||
if action.name == venv.envconfig.config.isolated_build_env:
|
||||
raise exceptions.SkipEnvironment(
|
||||
f"Skipping isolated packaging build env '{action.name}'"
|
||||
)
|
||||
|
||||
if venv.envconfig.config.option.require_poetry:
|
||||
if venv.options.require_poetry:
|
||||
logger.warning(
|
||||
"DEPRECATION: The '--require-poetry' runtime option is deprecated and will be "
|
||||
"removed in version 1.0.0. Please update test environments that require Poetry to "
|
||||
"set the 'require_poetry = true' option in tox.ini"
|
||||
)
|
||||
|
||||
if venv.envconfig.config.option.parallelize_locked_install is not None:
|
||||
logger.warning(
|
||||
"DEPRECATION: The '--parallelize-locked-install' option is deprecated and will "
|
||||
"be removed in version 1.0.0. Please use the '--parallel-install-threads' option."
|
||||
)
|
||||
|
||||
from tox_poetry_installer import _poetry
|
||||
|
||||
try:
|
||||
return _poetry.Factory().create_poetry(venv.envconfig.config.toxinidir)
|
||||
return _poetry.Factory().create_poetry(venv.core["tox_root"])
|
||||
# Support running the plugin when the current tox project does not use Poetry for its
|
||||
# environment/dependency management.
|
||||
#
|
||||
@@ -82,7 +67,7 @@ def convert_virtualenv(venv: ToxVirtualEnv) -> "_poetry.VirtualEnv":
|
||||
"""
|
||||
from tox_poetry_installer import _poetry
|
||||
|
||||
return _poetry.VirtualEnv(path=Path(venv.envconfig.envdir))
|
||||
return _poetry.VirtualEnv(path=Path(venv.env_dir))
|
||||
|
||||
|
||||
def build_package_map(poetry: "_poetry.Poetry") -> PackageMap:
|
||||
@@ -92,7 +77,7 @@ def build_package_map(poetry: "_poetry.Poetry") -> PackageMap:
|
||||
:returns: Mapping of package names to Poetry package objects
|
||||
"""
|
||||
packages = collections.defaultdict(list)
|
||||
for package in poetry.locker.locked_repository(True).packages:
|
||||
for package in poetry.locker.locked_repository().packages:
|
||||
packages[package.name].append(package)
|
||||
|
||||
return packages
|
||||
@@ -218,7 +203,7 @@ def find_project_deps(
|
||||
dep_name.lower(), packages, venv, allow_missing=[poetry.package.name]
|
||||
)
|
||||
|
||||
return dependencies
|
||||
return dedupe_packages(dependencies)
|
||||
|
||||
|
||||
def find_additional_deps(
|
||||
@@ -243,7 +228,34 @@ def find_additional_deps(
|
||||
dep_name.lower(), packages, venv, allow_missing=[poetry.package.name]
|
||||
)
|
||||
|
||||
return dependencies
|
||||
return dedupe_packages(dependencies)
|
||||
|
||||
|
||||
def find_group_deps(
|
||||
group: str,
|
||||
packages: PackageMap,
|
||||
venv: "_poetry.VirtualEnv",
|
||||
poetry: "_poetry.Poetry",
|
||||
) -> List[PoetryPackage]:
|
||||
"""Find the dependencies belonging to a dependency group
|
||||
|
||||
Recursively identify the Poetry dev dependencies
|
||||
|
||||
:param group: Name of the dependency group from the project's ``pyproject.toml``
|
||||
:param packages: Mapping of all locked package names to their corresponding package object
|
||||
:param venv: Poetry virtual environment to use for package compatibility checks
|
||||
:param poetry: Poetry object for the current project
|
||||
"""
|
||||
return find_additional_deps(
|
||||
packages,
|
||||
venv,
|
||||
poetry,
|
||||
poetry.pyproject.data["tool"]["poetry"]
|
||||
.get("group", {})
|
||||
.get(group, {})
|
||||
.get("dependencies", {})
|
||||
.keys(),
|
||||
)
|
||||
|
||||
|
||||
def find_dev_deps(
|
||||
@@ -257,9 +269,26 @@ def find_dev_deps(
|
||||
:param venv: Poetry virtual environment to use for package compatibility checks
|
||||
:param poetry: Poetry object for the current project
|
||||
"""
|
||||
return find_additional_deps(
|
||||
dev_group_deps = find_group_deps("dev", packages, venv, poetry)
|
||||
|
||||
# Legacy pyproject.toml poetry format:
|
||||
legacy_dev_group_deps = find_additional_deps(
|
||||
packages,
|
||||
venv,
|
||||
poetry,
|
||||
poetry.pyproject.data["tool"]["poetry"].get("dev-dependencies", {}).keys(),
|
||||
)
|
||||
|
||||
# Poetry 1.2 unions these two toml sections.
|
||||
return dedupe_packages(dev_group_deps + legacy_dev_group_deps)
|
||||
|
||||
|
||||
def dedupe_packages(packages: Sequence[PoetryPackage]) -> List[PoetryPackage]:
|
||||
"""Deduplicates a sequence of PoetryPackages while preserving ordering
|
||||
|
||||
Adapted from StackOverflow: https://stackoverflow.com/a/480227
|
||||
"""
|
||||
seen: Set[PoetryPackage] = set()
|
||||
# Make this faster, avoid method lookup below
|
||||
seen_add = seen.add
|
||||
return [p for p in packages if not (p in seen or seen_add(p))]
|
||||
|
||||
Reference in New Issue
Block a user