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

[ENH]: Test suite #38

Open
adrybakov opened this issue Sep 21, 2023 · 2 comments
Open

[ENH]: Test suite #38

adrybakov opened this issue Sep 21, 2023 · 2 comments

Comments

@adrybakov
Copy link
Contributor

Hello!

While making #37 I realised that there is no clear test suite for the TB2J.

If there is some, please correct me.

I propose the following strategy using pytest + hypothesis for the discussion:

  • Folder "utest" in the root folder (or other name with "test" in it)
  • Inside "utest" folder the files and folder repeat the structure of the "TB2J" folder from the root folder.
  • Each file and folder in the "utest" starts from the "test_"
  • Each file and folder in the "utest" contains unit tests for the corresponding functions and classes of the package.
  • Each function in the "utest" starts with "test_" and
  • Each class in "utest" starts with "Test"
  • Each class and function in the "utest" has the name of the class or function from the package for which it is written (if applicable).

With this strategy the tests can be run with the command from the root folder (after pip install pytest hypothesis):

pytest -s 

Example:

root/
├── ...
├── TB2J/
│   ├── file1.py
│   │   ├──> def function_1():
│   │   └──> class MyClass:
│   ├── submodule/
│   │   └── file2.py
│   │       └──> def function_2():
│   └── ...
├── utest/
│   ├── test_file1.py
│   │   ├──> def test_function_1_behaviour():
│   │   ├──> def test_function_1_raises():
│   │   └──> class TestMyClass:
│   ├── test_submodule/
│   │   └── test_file2.py
│   │       └──> def test_function_2():
│   └── ...
└── ...

P.S. An example of this strategy can be looked at in one of my repositories.

@mailhexu
Copy link
Owner

Indeed there is no unit test suite right now. It is definitely good to have it.
And it can eventually be integrated into the CI:
https://github.com/mailhexu/TB2J/blob/master/.travis.yml
I will start adding it.
Best wishes,
HeXu

@adrybakov
Copy link
Contributor Author

adrybakov commented Sep 28, 2023

Great!

It could be a good idea to add testing with the different Python versions to the CI to ensure that the code is compatible with the stated minimal and later versions of Python.

Best,
Andrey

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