Closed Ravenwater closed 2 years ago
Not sure if I fully understand the problem.
Looks to me the question is not cocotb-test
specific but pytest.
If I am not wrong pytest
by default will scan all directories and search for test_*.py
files. You can change this default behaviour with configuration files (https://docs.pytest.org/en/6.2.x/customize.html) using testpaths
variables.
You can use marking https://docs.pytest.org/en/6.2.x/example/markers.html
You can skip a test based on something (like where the test was started?) https://docs.pytest.org/en/7.1.x/how-to/skipping.html
@themperek Yep, you are completely right: this filtering needs to happen through pytest
configuration. Thank you for the pointer. I have created a pytest.ini
file configuring the knowledge to look for tests just in the tb/
directory and the behavior I was after emerged. I can populate the ini file in the repo and steer a newbie around these issues.
Very happy, and thank you for your insight to direct me to the answer.
Question: our design flow organizes each standalone hardware block in its own repo. It will manage its design files in an
hdl/
directory, and its testbench in atb/
directory. The idea being that the repo is a self-contained development environment for the design, debug, test, and release of that hardware block.When a hardware block is composed of dependent modules, we use an automation process where we specify the repo and the branch we want, and that gets cloned into the client alongside the repo content in a
ext/
directory.The problem we run into is that when you run
pytest
it will find the test benches in theext/
directory andpytest
will fail to build those test benches. We can use-k
to get just the top-level repo test bench, but I am looking for a configuration of therun
method ofcocotb_test.simulator
that simply ignores the test benches in theext/
directory so that newbies to a repository can simply invokepytest
to run the top-level test bench.Here is an example of a hardware block
mv_tile_fixed
that pulls in the dependentlut_power
module defined in thehw_block
repo that exhibits the problem of running the test bench of the external block.The test benches for blocks that aggregate other modules are written as follows:
How do we configure
run
so that the test benches that exist inext/<module>/tb
are ignored?