From 1f3ba3d09d921016c2c021aaeb2e4211aea1453c Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Sun, 8 May 2022 15:45:47 +1000 Subject: [PATCH] New makefile targets to specifically run tests of single modules --- src/blenderbim/Makefile | 8 ++++++++ src/blenderbim/docs/devs/running_tests.rst | 10 ++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/blenderbim/Makefile b/src/blenderbim/Makefile index 8828a7c727..84b93701ca 100644 --- a/src/blenderbim/Makefile +++ b/src/blenderbim/Makefile @@ -534,11 +534,19 @@ test-core: .PHONY: test-bim test-bim: +ifndef MODULE pytest test/bim +else + pytest test/bim -m "$(MODULE)" ./ --maxfail=1 +endif .PHONY: test-tool test-tool: +ifndef MODULE pytest test/tool +else + pytest test/tool/test_$(MODULE).py +endif .PHONY: qa qa: diff --git a/src/blenderbim/docs/devs/running_tests.rst b/src/blenderbim/docs/devs/running_tests.rst index 714cb0082a..165ddd1027 100644 --- a/src/blenderbim/docs/devs/running_tests.rst +++ b/src/blenderbim/docs/devs/running_tests.rst @@ -11,7 +11,7 @@ smoke tests. These tests use ``pytest`` as the test framework and runner. All development is expected to use test driven development, and so we expect test coverage to be 100% where it is technically possible to test. -When running tests, a Makefile target is provided for convenience so you can +When running tests, Makefile targets are provided for convenience so you can type in a simple command without knowing the internals. Because the BlenderBIM Add-on depends on IfcOpenShell, it is advised to also run @@ -57,13 +57,14 @@ of all concrete functions. .. code-block:: bash $ cd src/blenderbim/ - $ make test-tool + $ make test-tool # Test everything + $ make test-tool MODULE=foo # Only test a single module BlenderBIM Add-on tests ----------------------- The BIM layer acts as a full integration test. It is not possible to fully test -the UI, as we cannot reliable emit interface signals, nor read the interface as +the UI, as we cannot reliably emit interface signals, nor read the interface as a DOM of sorts. The best we can do is to call Blender operators as a smoke test, and also check simple property and scene changes. It has the same dependencies as the tool tests. @@ -71,4 +72,5 @@ as the tool tests. .. code-block:: bash $ cd src/blenderbim/ - $ make test-bim + $ make test-bim # Test everything + $ make test-bim MODULE=foo # Only test a single module