stdevel / katprep

Python toolkit for automating system maintenance and generating patch reports along with Foreman/Katello and Red Hat Satellite 6.x
GNU General Public License v3.0
35 stars 6 forks source link

If tests are run or skipped depends on CWD #146

Open okin opened 3 years ago

okin commented 3 years ago

Describe the bug The load_config function uses relative paths and so running pytest from the root directory does not pick up VM configs while running it from the tests folder does.

To Reproduce

  1. git clone the repo
  2. Install dependecies with pip install -r requirements-tests.txt
  3. go to the tests directory with cd tests/
  4. link the vagrant config files (i.e. ln -s nagios_config.json.vagrant nagios_config.json)
  5. Run pytest: It will pick up tests and tries to execute them, i.e. the tests for Nagios
  6. Move to the project root - cd ..
  7. Run pytest again: it will now skip the tests it attempted to run previously.

Expected behavior There is no difference if I run this inside the tests folder or not.

okin commented 3 years ago

Also the pytest config for being inside the folder tests/ and being in the project root are different. This leads to not always having the same test results.