moe-serifu-circle / moe-serifu-agent

Anime-themed personal assistant and goal-oriented intelligent agent

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Running unit tests causes config file under SCM to be modified

dekarrin opened this issue · comments

Describe the bug
When running unit tests, the config unit tests causes the tests/test.cfg file to be written to. The contents are the same, but as a failing test might not write the correct file back out, it's possible that on a failed test that git will pick changes and then have it be included in modified source files.

In particular, on Windows, due to python auto-translating line endings, the output tests/test.cfg actually does have different line endings then the original, so it is in particular making it difficult to run unit tests on windows.

To Reproduce
Steps to reproduce the behavior:

  1. On Windows:
  2. Run the unit tests
  3. Execute git status
  4. Note that git shows the file test/tests.cfg to have been modified.

Expected behavior
Running unit tests should not write to files that are under source control.

Desktop (please complete the following information):

  • OS: Windows 10 Pro

At the moment, *.cfg is not being used as a config file. So i think the solution is simply to remove:

  • msa/config.py
  • tests/config_tests.py

All *.json config lives in msa/core/config_manager.py

If we have invalid tests then they should absolutely be replaced with valid ones. Proposed fix makes sense to me with the stipulation that the config tests are not just removed but replaced with valid ones being a part of the acceptance criteria.

Ok, then with your permission, I will create a new task to add unit tests to the ConfigManager, and will go ahead and remove the unneeded files as proposed.

Wait are you saying to add unit tests for ConfigManager? Or to literally add them in to that module (as in not in the tests dir, but the actual module)?

No, you are correct i the first statement. Addunit tests for ConfigManager