Skip to content

Release v55.2.0

Compare
Choose a tag to compare
@clingen-sthlm clingen-sthlm released this 11 Jan 08:50
· 1191 commits to master since this release

feat - use fixture plugins instead of conftest files (#2816)(minor)

Fix #2095 and continue #2259.

TL;DR

The main conftest.py was too crowded, now the fixtures are separated into different modules available to all tests.

Details

The current test system looks for fixtures defined in the conftest.py files, either in the local directory or in any directory above, but it is impossible to use a fixture defined in a directory below it. For example, a test function in test_module_top.py can't access a fixture defined in tests/subfolder/subsubfolder/conftest.py:

tests
├── conftest.py
├── subfolder
│   ├── sub_subfolder
│   │   ├── __init__.py
│   │   ├── conftest.py
│   │   └── test_module_sub.py
└── test_module_top.py

To solve this, we started writing all our fixtures in the first contest, i.e. tests/conftest.py. This made this file extremely crowded and difficult to navigate.

This PR changes the conftest structure for a plugin structure, in which the fixtures are grouped by topic in a folder called fixture_plugins and imported in the conftest as a plugin. In this way, the structure of the tests is

tests
├── conftest.py
├── fixture_plugins
│   ├── fixture_subfolder
│   │   ├── fixtures_topic_1.py
│   │   └── __init__.py
│   ├── fixtures_topic_2.py
│   └── __init__.py
├── test_subfolder
│   ├── __init__.py
│   └── test_module_sub.py
└── test_module_top.py

and both test_module_top.py and test_module_sub.py have access to all the fixtures defined in fixture_plugins.

Added

  • Fixture plugin modules with fixtures in the new folder tests/fixture_plugins/ with the following structure:
tests
├── conftest.py
├── fixture_plugins
│   ├── demultiplex_fixtures
│   │   ├── __init__.py
│   │   ├── flow_cell_fixtures.py
│   │   ├── name_fixtures.py
│   │   ├── path_fixtures.py
│   │   ├── run_parameters_fixtures.py
│   │   └── sample_fixtures.py
│   ├── __init__.py
│   └── timestamp_fixtures.py

Changed

  • Moved demultiplexing and timestamp fixtures from conftest.py to separate modules in the new fixture plugin directory.