Skip to content

Latest commit

 

History

History
37 lines (23 loc) · 980 Bytes

TESTING.md

File metadata and controls

37 lines (23 loc) · 980 Bytes

Unit Testing

The InvenTree python bindings provide a number of unit tests to ensure the code is working correctly. Tests must be run against an instance of the InvenTree web server.

Testing Code

Unit testing code is located in the ./test/ directory - test files conform to the filename pattern test_<xyz>.py.

Writing Tests

Any new features should be accompanied by a set of appropriate unit tests, which cover the new features.

Running Tests

The simplest way to run tests locally is to simply run the following command:

invoke test

This assumes you have installed, on your path:

  • python (with requirements in requirements.txt)
  • invoke
  • docker-compose

Before the first test, run the following:

invoke update-image

The invoke-test command performs the following sequence of actions:

  • Ensures the test InvenTree server is running (in a docker container)
  • Resets the test database to a known state
  • Runs the suite of unit tests