molmod / psiflow

scalable molecular simulation
https://molmod.github.io/psiflow/
MIT License
115 stars 8 forks source link

Undefined variables in `psiflow.utils` #12

Closed Andrew-S-Rosen closed 10 months ago

Andrew-S-Rosen commented 10 months ago

https://github.com/molmod/psiflow/blob/e011c2b1712396d61550717fb6e30c7b75aec290/psiflow/utils.py#L393-L409

In the _check_distances() function, it looks like NullState is not imported and therefore not defined. Similarly, FlowAtoms in compute_error() is not defined.

Could you provide some insight on where they are being imported, assuming it's not an error?

svandenhaute commented 10 months ago

The tests pass so it certainly works, but I don't understand why. Also the numpy import is not done properly. One way or another, the namespace inside a python_app gets contaminated with general pytest/psiflow imports I think. It's not a problem, but I agree it's a little ugly.

Andrew-S-Rosen commented 10 months ago

When you start a pytest run, during the collection phase it imports all the modules from your tests that are accessible by the collection. So, it is possible that this is why your tests are passing. Either way, the current approach seems a bit risky. It's probably better to just add the missing imports.