Skip to content

Made tests uninstallable#189

Merged
orbeckst merged 5 commits intoBecksteinlab:masterfrom
whitead:issue-182
Sep 15, 2020
Merged

Made tests uninstallable#189
orbeckst merged 5 commits intoBecksteinlab:masterfrom
whitead:issue-182

Conversation

@whitead
Copy link
Collaborator

@whitead whitead commented Sep 3, 2020

Based on @orbeckst's recommendation, made tests part of the package itself. Addresses #182. I tried to modify Travis CI file, but we'll see if it works.

@theavey
Copy link
Contributor

theavey commented Sep 3, 2020

For some context, that change was made in #165 to test changes related to #124. The issue was (as I recall) that in order to test it, a change had to be made to before anything was imported. When running the pytests when they are nested within the same directories, the package will be imported before the necessary changes could be made.

It is definitely possible that there were better ways to work around this, or that pytest has changed such that this is no longer an issue. Also, a judgement could be made that testing that functionality is not important enough to justify making the tests harder to access and reference.

To be clear, I am not opposed to this (and I am also no longer an active user of this package), but I wanted to provide more info.

@whitead
Copy link
Collaborator Author

whitead commented Sep 3, 2020

@theavey Thanks for the context! What are thoughts on making the tests not an installable package, but just part of the CI process and for developers vs putting it in the repo to be installed via pip and by end users?

@orbeckst
Copy link
Member

orbeckst commented Sep 3, 2020

Yes, I agree (see also #182 (comment)).

Thanks @theavey for providing the explanation and thanks @whitead for looking into the problem.

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

According to the discussion, we don't want to make tests part of the package. Instead, we just don't install it.

@whitead whitead changed the title Moved tests to be part of package Made tests uninstallable Sep 3, 2020
Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

I think that tests is still a package because tests/__init__.py is still present. Can we keep it that way but just not include it in setup.py? Then we could also keep using relative imports inside the tests, which is less error-prone than absolute ones.

import gromacs.setup

from .datafiles import datafile
from datafiles import datafile
Copy link
Member

Choose a reason for hiding this comment

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

Do relative imports not work anymore because it's not a package anymore? Otherwise, adding the

from __future__ import absolute_import

and keeping the relative import would be nicer.

I look at it and think "Eww... not a relative import".

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That was an accident, fixed it. I have kept it as a package and removed it from setup.py

@orbeckst orbeckst merged commit a4492a1 into Becksteinlab:master Sep 15, 2020
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.

Package installs 'tests' package which is likely a bug in the build system

3 participants