lib
: top-level module. The main functionality of the package is kept here.services
: main modules comprising the backend of the system, e.g. serial clients and chemistry calculations.utils
: extra modules not considered to be core services.view
: modules defining the desktop user interface.
Each module within these directories has a sub-directory called tests
which stores unit tests for that module.
We generally follow PEP8, and prefer Google-style docstrings for Python code.
If you find a bug, or want to request a new feature be added, submit these as an issue.
We follow a "Gitflow" development workflow, in which the main
branch stores the latest release and the develop
branch is used for active development.
To contribute code, follow these steps:
- Fork the current state of the
develop
branch into your own repository - Name your own branch with the schema
feature/<description>
, with the description being as short as possible while still clarifying what the branch contains. - Submit a pull request against this repository's
develop
branch from yourfeature
branch.
Any changes we merge will require pytest-compatible unit tests before being incorporated. See the section below for more information.
Pytest is a standard framework for unit testing in python applications. For more information about pytest, see the pytest documentation.
See any of the tests
sub-directories (e.g., here) for examples of how these tests are written.
You can run the test suite yourself to see what it looks like: if on Linux, run the command make test
from the repository's toplevel directory; if on Windows, activate the virtual environment and run the command python -m pytest
from the same location.
- In order for your unit tests to be run, two naming conventions must be followed
- File names: must end with
_test.py
. Only files that end with_test.py
will be collected and found by pytest.- We will follow the format of copying the name of the file to be tested and appending
_test.py
to that. - Example: In order to test a file named
new_feature.py
, there will be a corresponding test file namednew_feature_test.py
- We will follow the format of copying the name of the file to be tested and appending
- Test names: must start with
test_
. In order for individual test methods to be found by pytest, they must start withtest_
.- To test the happy path for a method named
my_method()
, you could write a test calleddef test_my_method__success()
. - To test the sad path for that same method, you could write a test called
def test_my_method__fails()
.
- To test the happy path for a method named
- File names: must end with