Skip to content

Use pytest.fixtures for starting servers, use importlib*metadata #396

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

Merged
merged 2 commits into from
Apr 14, 2023

Conversation

bollwyvl
Copy link
Collaborator

@bollwyvl bollwyvl commented Apr 13, 2023

References

Code Changes

  • add conftest.py
    • add a number of @fixtures to support starting a server
  • remove use of hard-coded PORT and TOKEN
    • ensure coverage is captured
  • remove pytest.ini
  • move pytest config to pyproject.toml
  • squash some test warnings
    • use importlib(.|_)metadata instead of pkg_resources (undeclared setuptools dep)
  • remove bit about starting a server before testing in CONTRIBUTING.md

Future Work

  • further isolate the test environment with e.g. custom $HOME (tricky on windows)
  • split up existing test_proxies.py into smaller files
  • potentially move some more repetitive things to fixtures
  • add parameterization of --tornado_settings base_url=/foo/bar/ to test nested paths
  • fix more test warnings
    • hoist new test warnings to errors
  • improve speed
    • starting a sever takes about 1.5s
    • can be challenging to get the scope correct with e.g. tmp_path
    • the widely-used pytest-xdist can run tests in parallel for a moderate speedup, but carries some additional costs
    • some ports, etc. in the jupyter_server_config.py, and tests, still hard-coded, and would collide

@bollwyvl bollwyvl force-pushed the gh-309-server-fixture branch from 35ccff9 to f452c4d Compare April 13, 2023 19:19
@bollwyvl bollwyvl changed the title Use fixtures for starting servers Use pytest.fixtures for starting servers Apr 13, 2023
@bollwyvl bollwyvl changed the title Use pytest.fixtures for starting servers Use pytest.fixtures for starting servers, use importlib*metadata Apr 13, 2023
@bollwyvl bollwyvl marked this pull request as ready for review April 13, 2023 19:30
@Finesim97
Copy link

This will close #378.

Copy link
Member

@consideRatio consideRatio left a comment

Choose a reason for hiding this comment

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

Looks great, thank you @bollwyvl!!!

@consideRatio
Copy link
Member

Is this to be listed under the changelog as a bugfix and/or maintenance? Typically I've avoided having it listed twice, but I figure it should be seen under bugfix since its fixes a reported bug etc, but the title is all about maintenance.

Let's make it list under both this time.

@consideRatio consideRatio merged commit fb39fa7 into jupyterhub:main Apr 14, 2023
@Finesim97
Copy link

Thank you both!

@bollwyvl
Copy link
Collaborator Author

bollwyvl commented Apr 14, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DistributionNotFound(Requirement.parse('webcolors>=1.11; extra == "format-nongpl"'), Make launching lab/notebook server under test more automated
3 participants