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

TST: Added tests checking entry_points discovery and config initialisation #89

Merged

Conversation

Schefflera-Arboricola
Copy link
Member

@Schefflera-Arboricola Schefflera-Arboricola commented Oct 15, 2024

and updated networkx version to 3.4.2

@Schefflera-Arboricola Schefflera-Arboricola marked this pull request as draft October 15, 2024 07:29
@Schefflera-Arboricola Schefflera-Arboricola marked this pull request as ready for review October 19, 2024 02:35
Copy link
Member

@dschult dschult left a comment

Choose a reason for hiding this comment

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

This looks good. I have some questions below.

@@ -4,6 +4,7 @@
import nx_parallel as nxp


@pytest.mark.order(2)
Copy link
Member

Choose a reason for hiding this comment

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

I suspect this isn't directly related to the point of this PR, but since we're here:
At the bottom of this test, it looks like we are checking that n_jobs=0 raises a specific ValueError.
Can those 5 lines be done using pytest.raises? Something like:

    with pytest.raises(ValueError, match="n_jobs == 0 in Parallel has no meaning"):
        nxp.get_n_jobs(0)

Copy link
Member Author

@Schefflera-Arboricola Schefflera-Arboricola Oct 22, 2024

Choose a reason for hiding this comment

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

yes, and I think we can do that in a different PR

)


@pytest.mark.order(1)
Copy link
Member

Choose a reason for hiding this comment

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

Why does the order matter here?

  • If the order(2) test is run first, how does that affect this one?
  • Is it that we need side effects from this test in the setup of the other test?

Copy link
Member Author

Choose a reason for hiding this comment

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

because configurations are global, so the ordering of the tests matter

Copy link
Member

@dschult dschult left a comment

Choose a reason for hiding this comment

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

I now understand why the order(1) needs to be first -- otherwise the nx.config values might have been changed by the other tests (there are side effects of the tests).

And if I understand corretly the order(2) needs to be run before the others so we can test that the default number of n_jobs is 1.

Should we be managing the nx.configs around all the tests?
Maybe with an automated setup for each test that resets nx.config to its default values?
That might be simpler code-wise than relying on test order -- but it also might slow down the tests.

Anyway, I approve this PR as is and we can switch to a universal setup of the nx.config in another PR if we want.

Thanks!!

@Schefflera-Arboricola Schefflera-Arboricola merged commit a63bbb4 into networkx:main Oct 24, 2024
11 checks passed
@Schefflera-Arboricola Schefflera-Arboricola added this to the 0.3 milestone Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants