Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add developer instructions #49

Open
mdavis-xyz opened this issue Jan 6, 2025 · 3 comments
Open

Add developer instructions #49

mdavis-xyz opened this issue Jan 6, 2025 · 3 comments

Comments

@mdavis-xyz
Copy link
Contributor

I want to write a pull request for #47 . I'm not sure exactly how to get set up and run tests.

For #48 I just did pip install -e ./ in a virtual env, then ran a test script outside the repo. But for #47 I'll need to be more comprehensive with tests.

I can see from the existing test scripts that this project uses unittest not pytest. But I can't figure out how to run them. (python3 -m unittest says no tests found.) Should I even be running all tests? (Seeing #16 makes me think the tests aren't supposed to be run for each change. How can I run just the relevant subset?)

I see a pyproject.toml. I don't know how to use that. That file mentions rye and hatch. Do I need those?

I see requirements*.lock files, instead of requirements.txt. I don't know if pip will find them, or if I'm supposed to use poetry or something else.

I would like a paragraph added to the README or Wiki that explains how to get set up, run tests etc.

@mdavis-xyz
Copy link
Contributor Author

Here's an example of the errors I get when trying to run the tests:

(venv) matthew@zenbook:~/Documents/Projects/software/nemosis/NEMOSIS/tests$ python3 -m unittest test_data_fetch_methods.TestCacheCompiler
E
======================================================================
ERROR: test_data_fetch_methods (unittest.loader._FailedTest.test_data_fetch_methods)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_data_fetch_methods
Traceback (most recent call last):
  File "/usr/lib/python3.12/unittest/loader.py", line 137, in loadTestsFromName
    module = __import__(module_name)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/matthew/Documents/Projects/software/nemosis/NEMOSIS/tests/test_data_fetch_methods.py", line 7, in <module>
    from src.nemosis import custom_tables, defaults, filters, data_fetch_methods
ModuleNotFoundError: No module named 'src'


----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)
(venv) matthew@zenbook:~/Documents/Projects/software/nemosis/NEMOSIS/tests$ cd ../
(venv) matthew@zenbook:~/Documents/Projects/software/nemosis/NEMOSIS$ python3 -m unittest tests/test_data_fetch_methods.TestCacheCompiler
E
======================================================================
ERROR: tests/test_data_fetch_methods (unittest.loader._FailedTest.tests/test_data_fetch_methods)
----------------------------------------------------------------------
ImportError: Failed to import test module: tests/test_data_fetch_methods
Traceback (most recent call last):
  File "/usr/lib/python3.12/unittest/loader.py", line 137, in loadTestsFromName
    module = __import__(module_name)
             ^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'tests/test_data_fetch_methods'


----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)

@nick-gorman
Copy link
Member

This is an excellent suggestion. I should be done with a PR addressing this shortly :)

@nick-gorman
Copy link
Member

Hmmm a bunch of tests are failing because AEMO has changed how the bidding data is stored again.

You can take a look at #50 in the interim, but I'll complete the guide on testing once I get them all running again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants