Commit 473af4d
committed
Ensure
Previously (PR tox-dev#3591) a new hook point was added. The tests checked
that it works well with the `tox config` and `tox list` commands.
However, `tox run` turned out to have a problem — it would complain
that there's no such env, when invoked:
```console
ROOT: 170 E HandledError| provided environments not found in configuration file:
pip-compile-tox-env-lock [tox/run.py:23]
```
Turned out, this was because the config object is being interated twice
in some subcommands. This in turn iterates over the discovered
additional ephemeral environments list object. The implementation passes
an iterator into it and so when it's first accessed, it's exhausted and
the second attempt does not give the same envs, causing inconsistency.
The patch solves this by using `itertools.tee()`, making sure that the
underlying iterable is always cached and it's possible to repeat
iteration as many times as possible without loosing the data in the
process.tox_extend_envs list can be read twice1 parent e911788 commit 473af4d
File tree
3 files changed
+12
-4
lines changed- src/tox
- config
- session
- tests/plugin
3 files changed
+12
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
0 commit comments