Skip to content

Testing

PyGerber uses pytest for testing purposes. All tests are contained in tests/ directory. Tests are grouped in 3 categories:

  • unit: tests for individual functionalities, testing those in separation from rest of the project
  • e2e: end-to-end tests, testing full flows from user provided data to user consumable output
  • examples: automatically validated code exampled used in documentation

Assets used as input data for tests are stored in tests/assets/ directory. Assets used as output reference data are stored in separate repository: pygerber_reference_assets.

Example of test making use of reference data can be found in test/unit/test_console/test_gerber.py - test_gerber_convert_png. Reference asset must be generated by special execution mode of the test, guarded by is_regeneration_enabled fixture. To regenerate test asset (or generate it for the first time) you have to run that test alone with --regenerate flag. To commit regenerated assets, use --auto-commit-regenerated flag.

pytest -k test_gerber_convert_png --regenerate --auto-commit-regenerated