cclib icon indicating copy to clipboard operation
cclib copied to clipboard

Check imports within test directory

Open berquist opened this issue 7 years ago • 3 comments

In test/data/testSP.py there is a line:

from common import get_minimum_carbon_separation
  1. Check imports in test directory again: using local imports like this is dangerous.
  2. Common functions should go in a file with a more descriptive name than common, maybe test_utils. Combine with absolute/relative import.

berquist avatar Apr 17 '18 01:04 berquist

So we cannot do absolute import for these currently, because test file don't get installed. I guess it makes sense to move the utils (current common) to the installed part and absolutely import that. Not sure we can do much about import actual test modules... those probably need to stay relative.

langner avatar Feb 05 '19 16:02 langner

I suppose we can move the test directory into cclib and then the imports in test files would be from cclib.test.data testSP or similar, and would still be local (not installed) when run with python -m cclib.test.test_data. Thoughts?

(pushing back to v1.6.2)

langner avatar Feb 07 '19 06:02 langner

I have noticed that the MolSSI cookiecutter (and perhaps the original) places tests inside the top-level module, rather than alongside it as we have now. I support that change.

berquist avatar Feb 09 '19 17:02 berquist