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: migrate from nosetest to pytest #238

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

neutrinoceros
Copy link
Member

@neutrinoceros neutrinoceros commented Oct 11, 2023

this is a subset of #229, focusing on migrating out of nosetest + yt's answer testing framework by rewriting tests in a simpler fashion with pytest

This PR removes nosetest as a requirement for tests. Namely, answer tests are converted to simple pytest functions (reference results are inlined). As a result, imports from yt.testing.answer_testing.framework are also dropped.

@neutrinoceros neutrinoceros force-pushed the drop_nose branch 3 times, most recently from 7e731ba to 51339ba Compare October 11, 2023 09:52
Copy link
Member

@brittonsmith brittonsmith left a comment

Choose a reason for hiding this comment

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

This PR has some fairly significant changes. It would be useful to have them outlined in the description so that I don't have to suss them out from the diff. As far as I can see, you are removing entirely the ability to save answers and test against them. I recognize that we were testing against the same changeset, but after this we will not be able to return to maintaining a gold standard of results. Adding answers inline is also going to limit the answers we are able to test against. Some discussion of why this needs to happen would be good, but minimally, this deserves a more detailed record of what's being changed.

def data_dir_load(fn, *args, **kwargs):
# wrap yt.load but only load from test_data_dir
path = os.path.join(ytcfg.get("yt", "test_data_dir"), fn)
return yt.load(path, *args, **kwargs)


def requires_sim(sim_fn, sim_type, file_check=False):
Copy link
Member

Choose a reason for hiding this comment

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

If this is being deprecated, what functionality is replacing it? Same for can_run_sim

Copy link
Member Author

Choose a reason for hiding this comment

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

None. The idea is that if anyone is using those functions downstream, they should be able to vendor them because they're very simple.

@neutrinoceros
Copy link
Member Author

I updated the PR description. You are right that, I'm effectively diminishing the flexibility of what tests can be implemented because I am not replacing the answer test framework by anything equivalent. To be clear, replacing this framework is a non-goal (to me). I'm just observing that

  • nosetest is unmaintained and is not compatible with Python 3.10+
  • the complexity it brings is not used (at the moment)

My personal opinion is that it justifies dropping nose as a dependency, which would simplify maintenance. Porting the framework to pytest is a substantial undertaking that I think should happen upstream (in yt itself), and that I have no desire to champion. This by no means implies that I want to impose this proposal as the de-facto way forward, but I want to make it clear what my personal limits are early in the discussion :-)

@neutrinoceros
Copy link
Member Author

@brittonsmith I should disclose that I do not see myself returning to this in the foreseeable future. I understand your objections but don't have the bandwidth to address them. Migrating from nose to pytest is a long-due necessity (here as well as in yt), but maybe this isn't the right approach for the project. Anyway, I will keep this open for another month or two in case anyone wants to continue it, and if nothing happens I'll just close it. Thanks for understanding.

@brittonsmith
Copy link
Member

@neutrinoceros sorry for being silent on this for so long. I've just been overwhelmed with teaching since last fall. I've discussed this with @cphyc and we're willing to take over responsibility for it. What we're probably going to do is simply write new tests for this package to use pytest straight away rather than trying to port what we have now. We're going to punt on this until the summer, but have committed to returning to it then. Let's leave this open for now and we will take over.

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

Successfully merging this pull request may close these issues.

3 participants