OrderedSet86 / gtnh-flow

Factory Optimization Flowcharts for Gregtech: New Horizons
MIT License
84 stars 24 forks source link

Adds back overclocking tests #25

Closed joegnis closed 6 months ago

joegnis commented 6 months ago

Used pytest's parametrized tests to make it more clear

OrderedSet86 commented 6 months ago

Imports are wrong, should be src.data.basicTypes for example so pytest . works in root directory. I tried pushing the change but not sure where it went image

OrderedSet86 commented 6 months ago

Nice, gh cli solved the problem image

joegnis commented 6 months ago

Ok that src. looks so weird to me. I can run the tests by pytest tests/test_overclocks.py in the project root without issues.

OrderedSet86 commented 6 months ago

Sure, but tests are not meant to be run individually like that unless you are debugging/developing a particular test. The idea is to run the whole test suite using pytest . If you want to run an individual test you can do pytest -m tests/test_overclocks

joegnis commented 6 months ago

I can pass all tests by running pytest . without src. on my side. Did you mean you can't do this on your machine? Maybe our pytest configs are different. I am just using the config out of box and version 8.1.1. Anyway this smells bad for me. src is only a directory, not a package. However we can leave this issue behind for now, because I've noticed that the project is filled with src. imports. Removing them from tests is probably not enough. To remove them from everywhere, I guess project structure needs a fix. I will look into this later

OrderedSet86 commented 6 months ago

Python has multiple valid ways to do imports, this is one of them. The imports are relative to the working directory of the caller, aka factory_graph.py in the root. We don't need to change it unless you want to turn it into a package - it would be wasted effort.

Did you mean you can't do this on your machine? Maybe our pytest configs are different. I am just using the config out of box and version 8.1.1.

Indeed, I am using 7.2.0, but I think it is because you are in the tests folder and not the root folder...