Skip to content
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

Fix flaky tests that depend on verbosity level #1743

Closed

Conversation

atugushev
Copy link
Member

@atugushev atugushev commented Nov 22, 2022

Partially addresses #1720.

log.verbosity is not thread safe. Better to pass verbosity as DI to avoid flaky tests.

Contributor checklist
  • Provided the tests for the changes.
  • Assure PR title is short, clear, and good to be included in the user-oriented changelog
Maintainer checklist
  • Assure one of these labels is present: backwards incompatible, feature, enhancement, deprecation, bug, dependency, docs or skip-changelog as they determine changelog listing.
  • Assign the PR to an existing or new milestone for the target version (following Semantic Versioning).

log.verbosity is not thread safe. Better to pass verbosity as DI,
to avoid flaky tests.
@atugushev atugushev added tests Testing and related things skip-changelog Avoid listing in changelog labels Nov 22, 2022
@atugushev atugushev changed the title Fix flaky tests that depend on verbosity Fix flaky tests that depend on verbosity level Nov 22, 2022
@ssbarnea ssbarnea enabled auto-merge (squash) November 22, 2022 18:50
@atugushev atugushev mentioned this pull request Nov 22, 2022
@atugushev
Copy link
Member Author

Heh, test_sync_up_to_date is failed for the same reason. It seems to me that we should make piptools.logging.log thread safe or pass it as DI.

def test_sync_up_to_date(capsys, runner):
        """
        Everything up-to-date should be printed.
        """
        sync(set(), set())
        captured = capsys.readouterr()
>       assert captured.out.splitlines() == ["Everything up-to-date"]
E       AssertionError: assert [] == ['Everything up-to-date']
E         Right contains one more item: 'Everything up-to-date'
E         Full diff:
E         - ['Everything up-to-date']
E         + []

@atugushev
Copy link
Member Author

atugushev commented Dec 10, 2022

FTR: to catch failed tests that depend on logs verbosity run the following command:

pytest tests/test_cli_sync.py::test_quiet_option tests/test_sync.py::test_sync_verbose -n0

atugushev added a commit to atugushev/pip-tools that referenced this pull request Dec 10, 2022
@atugushev
Copy link
Member Author

Superseded by #1761.

@atugushev atugushev closed this Dec 10, 2022
auto-merge was automatically disabled December 10, 2022 22:44

Pull request was closed

@atugushev atugushev deleted the fix-flaky-tests-depeding-on-verbosity branch December 10, 2022 22:44
atugushev added a commit to atugushev/pip-tools that referenced this pull request Dec 10, 2022
atugushev added a commit to atugushev/pip-tools that referenced this pull request Dec 10, 2022
atugushev added a commit to atugushev/pip-tools that referenced this pull request Dec 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog Avoid listing in changelog tests Testing and related things
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants