New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restore TOX_SKIP_ENV filtering #2707
Conversation
I think I have it, but what on earth is "verbosity level 2"? tox -vv? i.e. should I use logging.debug() for this? |
I am very confused about logging levels.
so level 2 is WARNING, and the default level is INFO, which is 3, but also the default level is 2, which is WARNING. → #2709 Anyway, I'm logging with .info(), and it's visible only if you pass a single -v to tox, which means the actual default is WARNING and the --help output lies to me? Should I change the log level of this message to .warning() so it would match docs/config.rst? → did so |
docs/changelog/2698.bugfix.rst
Outdated
@@ -0,0 +1,2 @@ | |||
``TOX_SKIP_ENV`` environment variable now works again (it was unintentionally |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please wrap at 120 characters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also do you want to add your user name here?
- :by:`x`.
tests/session/test_env_select.py
Outdated
ini = """ | ||
[tox] | ||
env_list = py3{10,9},mypy | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can include this in one line considering its simplicity.
tests/session/test_env_select.py
Outdated
monkeypatch.setenv("TOX_SKIP_ENV", "m[y]py") | ||
ini = """ | ||
[tox] | ||
env_list = py3{10,9},mypy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can include this in one line considering its simplicity.
src/tox/session/env_select.py
Outdated
def __init__(self, state: State) -> None: | ||
# needs core to load the default tox environment list | ||
# to load the package environments of a run environments we need the run environment builder | ||
# to load labels we need core + the run environment | ||
self.on_empty_fallback_py = True | ||
self._warned_about = set() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can move line 111 here; no need to define and then initialize it here; just initializing it is enough
src/tox/session/env_select.py
Outdated
tox_env_filter = os.environ.get("TOX_SKIP_ENV") | ||
tox_env_filter_re = re.compile(tox_env_filter) if tox_env_filter is not None else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This definition should happen in the constructor of this class, not every time on this call, no?
This is still documented in docs/config.rst. The only missing thing is the reporting at verbosity level 2. Fixes tox-dev#2698.
Logging this at DEBUG level (tox -vv) felt wrong to me, so I went with INFO (tox -v).
tox --help says verbosity level 2 is WARNING.
As far as I can tell, during runtime there's only one EnvSelector instance, so there's no danger of repeatedly warning about the same skipped environment when .iter() gets called several times. Fixes failing unit tests. (Oops. I only ran each test in isolation, because the entire test suite is a bit slow.)
Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
18971ca
to
924e32c
Compare
Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
Ah, sorry, I meant to take another look at this but was too busy yesterday. Thank you for finishing it! |
@@ -88,6 +93,8 @@ def register_env_select_flags( | |||
add_to.add_argument("-m", dest="labels", metavar="label", help=help_msg, default=[], type=str, nargs="+") | |||
help_msg = "factors to evaluate" | |||
add_to.add_argument("-f", dest="factors", metavar="factor", help=help_msg, default=[], type=str, nargs="+") | |||
help_msg = "exclude all environments selected that match this regular expression" | |||
add_to.add_argument("--skip-env", dest="skip_env", metavar="re", help=help_msg, default="", type=str) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this even more than the environment variable!
This PR contains the following updates: | Package | Type | Update | Change | Pending | |---|---|---|---|---| | [tox](https://togithub.com/tox-dev/tox) | dev | patch | `4.0.9` -> `4.0.11` | `4.1.0` (+8) | --- ### Release Notes <details> <summary>tox-dev/tox</summary> ### [`v4.0.11`](https://togithub.com/tox-dev/tox/releases/tag/4.0.11) [Compare Source](https://togithub.com/tox-dev/tox/compare/4.0.10...4.0.11) #### What's Changed - Show only default env list for tox config by default by [@​gaborbernat](https://togithub.com/gaborbernat) in [tox-dev/tox#2726 - NO_COLOR follows no-color.org logic instead of tox boolean by [@​gaborbernat](https://togithub.com/gaborbernat) in [tox-dev/tox#2727 - Restore TOX_SKIP_ENV filtering by [@​mgedmin](https://togithub.com/mgedmin) in [tox-dev/tox#2707 **Full Changelog**: tox-dev/tox@4.0.10...4.0.11 ### [`v4.0.10`](https://togithub.com/tox-dev/tox/compare/4.0.9...4.0.10) [Compare Source](https://togithub.com/tox-dev/tox/compare/4.0.9...4.0.10) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC43NC4wIiwidXBkYXRlZEluVmVyIjoiMzQuNzQuMCJ9--> Co-authored-by: descope[bot] <descope[bot]@users.noreply.github.com>
This is still documented in docs/config.rst. The only missing thing is the reporting at verbosity level 2.
I feel bad about the missing reporting. Could someone help me figure it out?
Fixes #2698.
Thanks for contribution
Please, make sure you address all the checklists (for details on how see
development documentation)!
tox -e fix
)docs/changelog
folder