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

Make fixtures in test_distances use return just the Universe and not the trajectory as well #3759

Closed
hmacdope opened this issue Jul 22, 2022 · 4 comments · Fixed by #3769
Closed
Labels

Comments

@hmacdope
Copy link
Member

hmacdope commented Jul 22, 2022

Is your feature request related to a problem?

Coming from some discussion on #3730 and a comment by @orbeckst: #3730 (comment)

The trajectory fixtures and their naming in test_distances.py are slightly confusing as they return the universe and the trajectory.
This is confusing and a little bit of an anti-pattern. An example is the following fixture:

@pytest.fixture()
def DCD_Universe():
    universe = MDAnalysis.Universe(PSF, DCD)
    trajectory = **universe.trajectory**
    return universe, trajctory

Describe the solution you'd like

Move to only returning the Universe and have each test call trajectory if required.

Describe alternatives you've considered

Leave it the way it is?

@hmacdope hmacdope added good-first-issue GSOC Starter outreachy-task Starter tasks for the Outreachy program testing labels Jul 22, 2022
@hsadia538
Copy link
Contributor

@hmacdope Hello, I want to work on this. Can you help me get started?

@ojeda-e
Copy link
Member

ojeda-e commented Aug 2, 2022

Hi @hsadia538, thanks for your interest in contributing to MDAnalysis!

As described in the issue, the current fixture DCD_Universe returns two elements: a universe and a trajectory. Usually, fixtures return only one element. In this particular case, we would prefer a fixture that returns an MDA universe only. Something like:

@pytest.fixture()
def DCD_Universe():
    universe = MDAnalysis.Universe(PSF, DCD)
    return universe

Then, by using a fixture that returns a universe only, we could update other unit tests in test_distances.py and retrieve the associated trajectory only if the unit test really needs it.

If you open a PR, please reference this issue as suggested by the template.
Thanks!

@hmacdope
Copy link
Member Author

hmacdope commented Aug 3, 2022

@hsadia538 would you be able to introduce yourself on the MDAnalsysis developer mailing list if you haven't already done so? . Its a good central place to meet the developers, discuss ideas and be a part of the community! Its is also really good for our record keeping :)

@hsadia538
Copy link
Contributor

@hmacdope I have already joined the developer's list but wasn't sure exactly how to get started.
I will do so now!

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 a pull request may close this issue.

3 participants