-
Notifications
You must be signed in to change notification settings - Fork 1
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
Automatic Running of Tests On Pull Request #1123
Conversation
for more information, see https://pre-commit.ci
…IMPACT/COSMOS into feature/add-github-actions
…ure/add-github-actions
for more information, see https://pre-commit.ci
A centralized logic has been implemented to streamline test execution across all workflows. Workflow: Django Test Suite on PR Checkout Merged Code: 1.Test Scope: Executes all pytest tests defined in the repository. Previously, tests were executed on the branch being pushed, Integration issues with the target branch (e.g., dev) were not accounted for. |
Take a look at whether you can use https://github.com/NASA-IMPACT/COSMOS/blob/dev/pytest.ini as a way to handle what is being done in init.sh. |
for more information, see https://pre-commit.ci
…IMPACT/COSMOS into feature/add-github-actions
for more information, see https://pre-commit.ci
…IMPACT/COSMOS into feature/add-github-actions
for more information, see https://pre-commit.ci
The issue with using pytest.ini is that the Django’s URL namespaces sometimes don’t fully register when running all tests together, leading to NoReverseMatch errors. The init.sh script avoids this issue by running each test file separately, ensuring that the URL configuration is properly loaded every time.This approach is more consistent and reliable. Note: Also resolved test failures in TestReindexingStatusTransitions by updating the mock to include the 'CollectionSelection' tag, ensuring proper execution of add_to_public_query() |
# Mock the GitHubHandler to return valid XML content | ||
self.mock_github_handler = patch("sde_collections.models.collection.GitHubHandler").start() | ||
|
||
self.mock_github_handler.return_value._get_file_contents.return_value.decoded_content = ( | ||
b'<?xml version="1.0" encoding="UTF-8"?>\n' | ||
b"<Sinequa>\n" | ||
b" <KeepHashFragmentInUrl>false</KeepHashFragmentInUrl>\n" | ||
b" <CollectionSelection>Sample Collection</CollectionSelection>\n" | ||
b"</Sinequa>" | ||
) | ||
|
||
self.addCleanup(patch.stopall) | ||
|
||
# Create the collection with the mock applied |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you take a look and see what this chunk of the code is actually doing so that I can understand it better? It doesn't seem like it interacts with the other test cases.
**Fixes #1111 **