-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Consistently pass verbosity flag to VCS module #13365
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
Conversation
I'm currently trying to isolate the failing test-cases locally. I'm executing Will resume in the next couple of days, first checking the expected output of the test cases, then figuring out what my implementation has changed. I doubt/hope it's anything major. |
@ByteB4rb1e You can pass extra arguments to the pytest invocation by adding
This is also covered in the pip contributing documentation: https://pip.pypa.io/en/stable/development/getting-started/#running-tests |
44ef433
to
10abf6f
Compare
One more thing that came to mind as I couldn't find a definitive requirement in the Development - Getting Started guide: Should the news fragment reference the issue the PR resolves, or the PR itself? I currently am referencing the issue it resolves. |
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.
Would it be a good idea if we add some mock-based tests so we are more confident what args are passed to the underlying module in what cases?
@uranusjr yes, definetly! Testing the interface at least makes sense... EDIT: reformatted and was able to identify the causes for 1. and 2., was related to how I interacted with the test runner.
|
The test case executions look better than I expected. All of this is redeemable. EDIT: Didn't understand the setup of the testing framework, do now... With nox bootstrapping it's working, albeit slow. The $> sh -x << 'EOF'
cd "$(mktemp -d)"
git clone --depth 1 --single-branch --branch feature/13329 \
https://github.com/ByteB4rb1e/pip.git .
python3 -m venv .venv
.venv/bin/python3 -m pip install --quiet --upgrade \
-r tests/requirements.txt -r tests/requirements-common_wheels.txt \
pip pytest nox
.venv/bin/pytest tests/unit/test_vcs.py::TestBazaarArgs
EOF
+ mktemp -d
+ cd /tmp/tmp.MioIic61HV
+ git clone --depth 1 --single-branch --branch feature/13329 https://github.com/ByteB4rb1e/pip.git .
Cloning into '.'...
remote: Enumerating objects: 1087, done.
remote: Counting objects: 100% (1087/1087), done.
remote: Compressing objects: 100% (959/959), done.
remote: Total 1087 (delta 71), reused 550 (delta 54), pack-reused 0 (from 0)
Receiving objects: 100% (1087/1087), 8.86 MiB | 825.00 KiB/s, done.
Resolving deltas: 100% (71/71), done.
+ python3 -m venv .venv
+ .venv/bin/python3 -m pip install --quiet --upgrade -r tests/requirements.txt -r tests/requirements-common_wheels.txt pip pytest
+ .venv/bin/pytest tests/unit/test_vcs.py::TestBazaarArgs
=============================== test session starts ================================
self = <tests.unit.test_vcs.TestBazaarArgs testMethod=test_update_quiet>
def test_update_quiet(self) -> None:
> self.svn.update(self.dest, hide_url(self.url), self.rev_options, verbosity=0)
E TypeError: Bazaar.update() got an unexpected keyword argument 'verbosity'
tests/unit/test_vcs.py:831: TypeError
============================= short test summary info ==============================
FAILED tests/unit/test_vcs.py::TestBazaarArgs::test_update - TypeError: Bazaar.update() got an unexpected keyword argument 'verbosity'
FAILED tests/unit/test_vcs.py::TestBazaarArgs::test_update_quiet - TypeError: Bazaar.update() got an unexpected keyword argument 'verbosity'
=========================== 2 failed, 3 passed in 0.16s ============================ |
The verbosity argument enables callers to control the supression of command output emitted by the Git submodule command. This is helpful for situations where the Git command call may take a long time, such as with many submodules registered in a repository, or a slow internet connection. The `verbosity` argument has, different than some of its caller methods, a boolean type for verbosity, as the options for verbosity are binary. Verbosity can only be supressed via the `--quiet` flag of the `git submodule update` command. Implements: pypa#13329
Since the method signature already provides an argument for controlling verbosity, it is now passed down to the `update_submodules` callee. Implements: pypa#13329
verbosity argument to the update method allows for controlling the supression of output executed from this method. The argument should be a boolean value as the `-q` flag is binary, but it now is of type int as to not require a refactor of the base class callers. Implements: pypa#13329
verbosity argument passed down to update_submodules callee, so that the supression of command outputs is properly cascaded. Implements: pypa#13329
verbosity argument to the update method allows for controlling the supression of output by commands executed from this method. The argument should be a boolean value as the `-q` flag is binary, but it now is of type int as to not require a major refactor of the base class, should other inherited classes also implement the extension of verbosity. Implements: pypa#13329
verbosity argument passed down to update_submodules callee, so that supression of command outputs is properly cascaded. Implements: pypa#13329
@ByteB4rb1e honestly I'm not sure I understand your terminal session, but you don't have to install the test requirements manually in your development environment. Nox will create and manage the testing environment for you. By default, we have nox configured to reinstall the environment dependencies. It's generally fast as the underlying environment is kept between runs, but it does still add some overhead (especially from the reinstall of the local pip). The I didn't add the It would be great if you could document this in the development guide!1 Footnotes
|
Thanks for the contribution by the way! |
@ichard26, my development environment is MSYS2, which emulates a POSIX environment under Windows. There are a couple of caveats to it, especially in regards to filesystem performance, hence I tend to avoid IO-intensive workflow abstractions in favor of a manual workflow. This translates to basically the same approach you referenced in the footnote. For some reason though executing I'm not sure if it's worthy of an issue report, but I'd really be interested if somebody was able to reproduce the behavior I described in regards to test executions without
Sure, I'll open a feature request later on. |
Implements #13329
As suggested by @uranusjr, I've adopted the interface of the already existing cascade for verbosity flagging.
Even though my feature request is only applicable to the Git VCS module, the interface of the super class forced me to also implement the verbosity flagging for all other subclasses.
Since the feature is applicable to subprocesses calls, which only causes changes to their stdout,
I did not deem it feasible to write specific unit tests for this feature.