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

Use pytest temporary folders and fixtures to create test file hierarchy at test time #516

Merged
merged 13 commits into from
May 15, 2024

Conversation

andrii-i
Copy link
Collaborator

@andrii-i andrii-i commented May 2, 2024

Improves Jupyter Scheduler pytest testing suite:

  • Provide root and staging folders as fixtures using temporary folders instead of hard-coding paths in tests and storing folders in the codebase
  • Store all test files in static folder, create file hierarchy to be tested at test time using temp folders and fixtures
  • Make test db fixture return a session so that there is no need to instantiate a session every time

Fixes #514.

@andrii-i andrii-i added enhancement New feature or request Testing labels May 2, 2024
… instead of uploading test dirs for execution manager test
… instead of uploading test dirs for scheduler tests
pre-commit-ci bot and others added 2 commits May 6, 2024 22:19
@andrii-i andrii-i marked this pull request as ready for review May 7, 2024 05:33
@andrii-i andrii-i requested a review from dlqqq May 7, 2024 05:33
@andrii-i andrii-i changed the title Use pytest temporary folders and fixtures Use pytest temporary folders and fixtures to create file hierarchy at test time May 7, 2024
Copy link
Collaborator

@JasonWeill JasonWeill left a comment

Choose a reason for hiding this comment

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

I took a look at this change and I don't have any suggestions for you. Thanks!

Copy link
Collaborator

@dlqqq dlqqq left a comment

Choose a reason for hiding this comment

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

Thanks @andrii-i! Left a few points of feedback below.

conftest.py Outdated Show resolved Hide resolved
conftest.py Outdated Show resolved Hide resolved
@andrii-i andrii-i requested a review from dlqqq May 14, 2024 18:05
@andrii-i andrii-i changed the title Use pytest temporary folders and fixtures to create file hierarchy at test time Use pytest temporary folders and fixtures to create test file hierarchy at test time May 14, 2024
Copy link
Collaborator

@dlqqq dlqqq left a comment

Choose a reason for hiding this comment

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

Some of the fixtures are still missing types, but more importantly the path fixtures are now typed. The remaining type hints can be addressed in a separate PR.

Awesome work @andrii-i! Approved.

@andrii-i andrii-i merged commit 7cf42f9 into jupyter-server:main May 15, 2024
7 checks passed
@andrii-i andrii-i deleted the improve-tests branch May 15, 2024 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prefer fixtures over hard-coded paths in tests
3 participants