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

Make the Python test log less messy #5456

Merged
merged 2 commits into from
Dec 16, 2022

Conversation

SpecLad
Copy link
Contributor

@SpecLad SpecLad commented Dec 13, 2022

See the individual commits for more information.

Motivation and context

I don't want to keep seeing warnings and interleaved docker-compose/pytest output each time I run the tests.

How has this been tested?

By running the tests. 🙂

Checklist

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

This suppresses "variable is not set" warnings that docker-compose shows when
you don't set those variables.
This makes the test output less messy. Fixtures are only created after the
first test starts running, so `docker-compose` output becomes intermixed
with the test log. The hooks, on the other hand, run before the tests are
even collected, so the output is separated from the test log.

This also makes runs with options like `--stop-services` a bit faster,
because pytest doesn't have to waste time collecting tests that won't even
be run.
Copy link
Contributor

@nmanovic nmanovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nmanovic nmanovic merged commit a6e5813 into cvat-ai:develop Dec 16, 2022
@SpecLad SpecLad deleted the improve-test-output branch December 28, 2022 09:37
nmanovic pushed a commit that referenced this pull request Jan 5, 2023
Turns out that #5456 had a nasty side effect. Session hooks are called
when pytest is run with `--collect-only` (even though no tests are
actually run in this case), and Visual Studio Code periodically runs
`pytest --collect-only` in order to learn what tests exist in the
project. As a result, it keeps restarting the services and restoring the
database in the background.

Work around this by skipping all logic in the hooks if `--collect-only`
is in the options.
mikhail-treskin pushed a commit to retailnext/cvat that referenced this pull request Jul 1, 2023
mikhail-treskin pushed a commit to retailnext/cvat that referenced this pull request Jul 1, 2023
…ai#5550)

Turns out that cvat-ai#5456 had a nasty side effect. Session hooks are called
when pytest is run with `--collect-only` (even though no tests are
actually run in this case), and Visual Studio Code periodically runs
`pytest --collect-only` in order to learn what tests exist in the
project. As a result, it keeps restarting the services and restoring the
database in the background.

Work around this by skipping all logic in the hooks if `--collect-only`
is in the options.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants