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

PB-1112: Use pytest #41

Merged
merged 1 commit into from
Nov 21, 2024
Merged

PB-1112: Use pytest #41

merged 1 commit into from
Nov 21, 2024

Conversation

msom
Copy link
Contributor

@msom msom commented Nov 19, 2024

This PR improves the test suite, which previously contained a mix of Django and pytest tests. It

  • moves all tests to app/tests to align with the structure of the other services
  • removes all __init__.py files within test folders to prevent test code from being auto-discovered outside of pytest
  • transfers the functionality of utils/testing.py to fixture(s) in conftest.py
  • adapts the tests to use pytest

Copy link
Contributor

@schtibe schtibe left a comment

Choose a reason for hiding this comment

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

Very nice, thank you!

I have made some comments along the reviewing concerning the naming of things. It wasn't always a 100% apparent what is what, maybe this gives you a hint for improvements.

app/tests/conftest.py Show resolved Hide resolved
app/tests/access/test_access_api.py Outdated Show resolved Hide resolved
app/tests/conftest.py Outdated Show resolved Hide resolved
app/tests/cognito/test_cognito_client.py Outdated Show resolved Hide resolved
app/tests/distributions/test_attribution_model.py Outdated Show resolved Hide resolved
app/tests/distributions/test_distributions_api.py Outdated Show resolved Hide resolved
@msom
Copy link
Contributor Author

msom commented Nov 20, 2024

Your right, naming was confusing! Cleanup done:

  • Changed all the data fixtures to individual fixtures returning single database objects
  • Renamed user_factory to django_user_factory
  • Moved the functionality of cognito_user to a global fixture cognito_user_response_factory
  • Documented the global (factory) fixtures

Copy link
Contributor

@schtibe schtibe left a comment

Choose a reason for hiding this comment

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

Nice, you made it even better! Thank you!

@msom msom merged commit c619fd2 into develop Nov 21, 2024
3 checks passed
@msom msom deleted the feat-PB-1112-pytest branch November 21, 2024 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants