refactor: upgrade to copier v1
This commit is contained in:
9
.copier-answers.yml
Normal file
9
.copier-answers.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Do not edit this file!
|
||||||
|
# It is needed to track the repo template version, and editing may break things.
|
||||||
|
# This file will be overwritten by copier on template updates.
|
||||||
|
|
||||||
|
_commit: v1.0.0
|
||||||
|
_src_path: https://gitea.psi.ch/bec/bec_plugin_copier_template.git
|
||||||
|
make_commit: false
|
||||||
|
project_name: phoenix_bec
|
||||||
|
widget_plugins_input: []
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,7 +7,6 @@
|
|||||||
**/.vscode
|
**/.vscode
|
||||||
**/.pytest_cache
|
**/.pytest_cache
|
||||||
**/*.egg*
|
**/*.egg*
|
||||||
*.gz
|
|
||||||
|
|
||||||
# recovery_config files
|
# recovery_config files
|
||||||
recovery_config_*
|
recovery_config_*
|
||||||
|
@ -3,4 +3,5 @@ include:
|
|||||||
inputs:
|
inputs:
|
||||||
name: phoenix_bec
|
name: phoenix_bec
|
||||||
target: phoenix_bec
|
target: phoenix_bec
|
||||||
|
branch: $CHILD_PIPELINE_BRANCH
|
||||||
project: bec/awi_utils
|
project: bec/awi_utils
|
||||||
|
3
LICENSE
3
LICENSE
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
BSD 3-Clause License
|
BSD 3-Clause License
|
||||||
|
|
||||||
Copyright (c) 2024, Paul Scherrer Institute
|
Copyright (c) 2025, Paul Scherrer Institute
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions are met:
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
1
bin/.gitignore
vendored
Normal file
1
bin/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
# Add anything you don't want to check in to git, e.g. very large files
|
0
phoenix_bec/bec_widgets/auto_updates/__init__.py
Normal file
0
phoenix_bec/bec_widgets/auto_updates/__init__.py
Normal file
0
phoenix_bec/scans/metadata_schema/__init__.py
Normal file
0
phoenix_bec/scans/metadata_schema/__init__.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# from .metadata_schema_template import ExampleSchema
|
||||||
|
|
||||||
|
METADATA_SCHEMA_REGISTRY = {
|
||||||
|
# Add models which should be used to validate scan metadata here.
|
||||||
|
# Make a model according to the template, and import it as above
|
||||||
|
# Then associate it with a scan like so:
|
||||||
|
# "example_scan": ExampleSchema
|
||||||
|
}
|
||||||
|
|
||||||
|
# Define a default schema type which should be used as the fallback for everything:
|
||||||
|
|
||||||
|
DEFAULT_SCHEMA = None
|
@ -0,0 +1,34 @@
|
|||||||
|
# # By inheriting from BasicScanMetadata you can define a schema by which metadata
|
||||||
|
# # supplied to a scan must be validated.
|
||||||
|
# # This schema is a Pydantic model: https://docs.pydantic.dev/latest/concepts/models/
|
||||||
|
# # but by default it will still allow you to add any arbitrary information to it.
|
||||||
|
# # That is to say, when you run a scan with which such a model has been associated in the
|
||||||
|
# # metadata_schema_registry, you can supply any python dictionary with strings as keys
|
||||||
|
# # and built-in python types (strings, integers, floats) as values, and these will be
|
||||||
|
# # added to the experiment metadata, but it *must* contain the keys and values of the
|
||||||
|
# # types defined in the schema class.
|
||||||
|
# #
|
||||||
|
# #
|
||||||
|
# # For example, say that you would like to enforce recording information about sample
|
||||||
|
# # pretreatment, you could define the following:
|
||||||
|
# #
|
||||||
|
#
|
||||||
|
# from bec_lib.metadata_schema import BasicScanMetadata
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# class ExampleSchema(BasicScanMetadata):
|
||||||
|
# treatment_description: str
|
||||||
|
# treatment_temperature_k: int
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# # If this was used according to the example in metadata_schema_registry.py,
|
||||||
|
# # then when calling the scan, the user would need to write something like:
|
||||||
|
# >>> scans.example_scan(
|
||||||
|
# >>> motor,
|
||||||
|
# >>> 1,
|
||||||
|
# >>> 2,
|
||||||
|
# >>> 3,
|
||||||
|
# >>> metadata={"treatment_description": "oven overnight", "treatment_temperature_k": 575},
|
||||||
|
# >>> )
|
||||||
|
#
|
||||||
|
# # And the additional metadata would be saved in the HDF5 file created for the scan.
|
@ -5,7 +5,7 @@ build-backend = "hatchling.build"
|
|||||||
[project]
|
[project]
|
||||||
name = "phoenix_bec"
|
name = "phoenix_bec"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
description = "Custom device implementations based on the ophyd hardware abstraction layer"
|
description = "The Phoenix plugin repository for BEC"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"Development Status :: 3 - Alpha",
|
"Development Status :: 3 - Alpha",
|
||||||
@ -17,6 +17,7 @@ dependencies = []
|
|||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
dev = [
|
dev = [
|
||||||
"black",
|
"black",
|
||||||
|
"copier",
|
||||||
"isort",
|
"isort",
|
||||||
"coverage",
|
"coverage",
|
||||||
"pylint",
|
"pylint",
|
||||||
@ -38,12 +39,15 @@ plugin_file_writer = "phoenix_bec.file_writer"
|
|||||||
[project.entry-points."bec.scans"]
|
[project.entry-points."bec.scans"]
|
||||||
plugin_scans = "phoenix_bec.scans"
|
plugin_scans = "phoenix_bec.scans"
|
||||||
|
|
||||||
|
[project.entry-points."bec.scans.metadata_schema"]
|
||||||
|
plugin_metadata_schema = "phoenix_bec.scans.metadata_schema"
|
||||||
|
|
||||||
[project.entry-points."bec.ipython_client_startup"]
|
[project.entry-points."bec.ipython_client_startup"]
|
||||||
plugin_ipython_client_pre = "phoenix_bec.bec_ipython_client.startup.pre_startup"
|
plugin_ipython_client_pre = "phoenix_bec.bec_ipython_client.startup.pre_startup"
|
||||||
plugin_ipython_client_post = "phoenix_bec.bec_ipython_client.startup"
|
plugin_ipython_client_post = "phoenix_bec.bec_ipython_client.startup"
|
||||||
|
|
||||||
[project.entry-points."bec.widgets.auto_updates"]
|
[project.entry-points."bec.widgets.auto_updates"]
|
||||||
plugin_widgets_update = "phoenix_bec.bec_widgets.auto_updates:PlotUpdate"
|
plugin_widgets_update = "phoenix_bec.bec_widgets.auto_updates"
|
||||||
|
|
||||||
[project.entry-points."bec.widgets.user_widgets"]
|
[project.entry-points."bec.widgets.user_widgets"]
|
||||||
plugin_widgets = "phoenix_bec.bec_widgets.widgets"
|
plugin_widgets = "phoenix_bec.bec_widgets.widgets"
|
||||||
|
@ -1,23 +1,27 @@
|
|||||||
# Getting Started with Testing using pytest
|
# Getting Started with Testing using pytest
|
||||||
|
|
||||||
BEC is using the [pytest](https://docs.pytest.org/en/8.0.x/) framework.
|
BEC is using the [pytest](https://docs.pytest.org/en/latest/) framework.
|
||||||
It can be install via
|
It can be installed via
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install pytest
|
pip install pytest
|
||||||
```
|
```
|
||||||
in your *python environment*.
|
|
||||||
|
in your _python environment_.
|
||||||
We note that pytest is part of the optional-dependencies `[dev]` of the plugin package.
|
We note that pytest is part of the optional-dependencies `[dev]` of the plugin package.
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
Tests in this package should be stored in the `tests` directory.
|
Tests in this package should be stored in the `tests` directory.
|
||||||
We suggest to sort tests of different submodules, i.e. `scans` or `devices` in the respective folder structure, and to folow a naming convention of `<test_module_name.py>`.
|
We suggest to sort tests of different submodules, i.e. `scans` or `devices` in the respective folder structure, and to folow a naming convention of `<test_module_name.py>`.
|
||||||
|
It is mandatory for test files to begin with `test_` for pytest to discover them.
|
||||||
|
|
||||||
To run all tests, navigate to the directory of the plugin from the command line, and run the command
|
To run all tests, navigate to the directory of the plugin from the command line, and run the command
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pytest -v --random-order ./tests
|
pytest -v --random-order ./tests
|
||||||
```
|
```
|
||||||
|
|
||||||
Note, the python environment needs to be active.
|
Note, the python environment needs to be active.
|
||||||
The additional arg `-v` allows pytest to run in verbose mode which provides more detailed information about the tests being run.
|
The additional arg `-v` allows pytest to run in verbose mode which provides more detailed information about the tests being run.
|
||||||
The argument `--random-order` instructs pytest to run the tests in random order, which is the default in the CI pipelines.
|
The argument `--random-order` instructs pytest to run the tests in random order, which is the default in the CI pipelines.
|
||||||
@ -28,4 +32,3 @@ Writing tests can be quite specific for the given function.
|
|||||||
We recommend writing tests as isolated as possible, i.e. try to test single functions instead of full classes.
|
We recommend writing tests as isolated as possible, i.e. try to test single functions instead of full classes.
|
||||||
A very useful class to enable isolated testing is [MagicMock](https://docs.python.org/3/library/unittest.mock.html).
|
A very useful class to enable isolated testing is [MagicMock](https://docs.python.org/3/library/unittest.mock.html).
|
||||||
In addition, we also recommend to take a look at the [How-to guides from pytest](https://docs.pytest.org/en/8.0.x/how-to/index.html).
|
In addition, we also recommend to take a look at the [How-to guides from pytest](https://docs.pytest.org/en/8.0.x/how-to/index.html).
|
||||||
|
|
||||||
|
@ -1,23 +1,27 @@
|
|||||||
# Getting Started with Testing using pytest
|
# Getting Started with Testing using pytest
|
||||||
|
|
||||||
BEC is using the [pytest](https://docs.pytest.org/en/8.0.x/) framework.
|
BEC is using the [pytest](https://docs.pytest.org/en/latest/) framework.
|
||||||
It can be install via
|
It can be installed via
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install pytest
|
pip install pytest
|
||||||
```
|
```
|
||||||
in your *python environment*.
|
|
||||||
|
in your _python environment_.
|
||||||
We note that pytest is part of the optional-dependencies `[dev]` of the plugin package.
|
We note that pytest is part of the optional-dependencies `[dev]` of the plugin package.
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
Tests in this package should be stored in the `tests` directory.
|
Tests in this package should be stored in the `tests` directory.
|
||||||
We suggest to sort tests of different submodules, i.e. `scans` or `devices` in the respective folder structure, and to folow a naming convention of `<test_module_name.py>`.
|
We suggest to sort tests of different submodules, i.e. `scans` or `devices` in the respective folder structure, and to folow a naming convention of `<test_module_name.py>`.
|
||||||
|
It is mandatory for test files to begin with `test_` for pytest to discover them.
|
||||||
|
|
||||||
To run all tests, navigate to the directory of the plugin from the command line, and run the command
|
To run all tests, navigate to the directory of the plugin from the command line, and run the command
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pytest -v --random-order ./tests
|
pytest -v --random-order ./tests
|
||||||
```
|
```
|
||||||
|
|
||||||
Note, the python environment needs to be active.
|
Note, the python environment needs to be active.
|
||||||
The additional arg `-v` allows pytest to run in verbose mode which provides more detailed information about the tests being run.
|
The additional arg `-v` allows pytest to run in verbose mode which provides more detailed information about the tests being run.
|
||||||
The argument `--random-order` instructs pytest to run the tests in random order, which is the default in the CI pipelines.
|
The argument `--random-order` instructs pytest to run the tests in random order, which is the default in the CI pipelines.
|
||||||
@ -28,4 +32,3 @@ Writing tests can be quite specific for the given function.
|
|||||||
We recommend writing tests as isolated as possible, i.e. try to test single functions instead of full classes.
|
We recommend writing tests as isolated as possible, i.e. try to test single functions instead of full classes.
|
||||||
A very useful class to enable isolated testing is [MagicMock](https://docs.python.org/3/library/unittest.mock.html).
|
A very useful class to enable isolated testing is [MagicMock](https://docs.python.org/3/library/unittest.mock.html).
|
||||||
In addition, we also recommend to take a look at the [How-to guides from pytest](https://docs.pytest.org/en/8.0.x/how-to/index.html).
|
In addition, we also recommend to take a look at the [How-to guides from pytest](https://docs.pytest.org/en/8.0.x/how-to/index.html).
|
||||||
|
|
||||||
|
@ -1,23 +1,27 @@
|
|||||||
# Getting Started with Testing using pytest
|
# Getting Started with Testing using pytest
|
||||||
|
|
||||||
BEC is using the [pytest](https://docs.pytest.org/en/8.0.x/) framework.
|
BEC is using the [pytest](https://docs.pytest.org/en/latest/) framework.
|
||||||
It can be install via
|
It can be installed via
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install pytest
|
pip install pytest
|
||||||
```
|
```
|
||||||
in your *python environment*.
|
|
||||||
|
in your _python environment_.
|
||||||
We note that pytest is part of the optional-dependencies `[dev]` of the plugin package.
|
We note that pytest is part of the optional-dependencies `[dev]` of the plugin package.
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
Tests in this package should be stored in the `tests` directory.
|
Tests in this package should be stored in the `tests` directory.
|
||||||
We suggest to sort tests of different submodules, i.e. `scans` or `devices` in the respective folder structure, and to folow a naming convention of `<test_module_name.py>`.
|
We suggest to sort tests of different submodules, i.e. `scans` or `devices` in the respective folder structure, and to folow a naming convention of `<test_module_name.py>`.
|
||||||
|
It is mandatory for test files to begin with `test_` for pytest to discover them.
|
||||||
|
|
||||||
To run all tests, navigate to the directory of the plugin from the command line, and run the command
|
To run all tests, navigate to the directory of the plugin from the command line, and run the command
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pytest -v --random-order ./tests
|
pytest -v --random-order ./tests
|
||||||
```
|
```
|
||||||
|
|
||||||
Note, the python environment needs to be active.
|
Note, the python environment needs to be active.
|
||||||
The additional arg `-v` allows pytest to run in verbose mode which provides more detailed information about the tests being run.
|
The additional arg `-v` allows pytest to run in verbose mode which provides more detailed information about the tests being run.
|
||||||
The argument `--random-order` instructs pytest to run the tests in random order, which is the default in the CI pipelines.
|
The argument `--random-order` instructs pytest to run the tests in random order, which is the default in the CI pipelines.
|
||||||
@ -28,4 +32,3 @@ Writing tests can be quite specific for the given function.
|
|||||||
We recommend writing tests as isolated as possible, i.e. try to test single functions instead of full classes.
|
We recommend writing tests as isolated as possible, i.e. try to test single functions instead of full classes.
|
||||||
A very useful class to enable isolated testing is [MagicMock](https://docs.python.org/3/library/unittest.mock.html).
|
A very useful class to enable isolated testing is [MagicMock](https://docs.python.org/3/library/unittest.mock.html).
|
||||||
In addition, we also recommend to take a look at the [How-to guides from pytest](https://docs.pytest.org/en/8.0.x/how-to/index.html).
|
In addition, we also recommend to take a look at the [How-to guides from pytest](https://docs.pytest.org/en/8.0.x/how-to/index.html).
|
||||||
|
|
||||||
|
@ -1,23 +1,27 @@
|
|||||||
# Getting Started with Testing using pytest
|
# Getting Started with Testing using pytest
|
||||||
|
|
||||||
BEC is using the [pytest](https://docs.pytest.org/en/8.0.x/) framework.
|
BEC is using the [pytest](https://docs.pytest.org/en/latest/) framework.
|
||||||
It can be install via
|
It can be installed via
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install pytest
|
pip install pytest
|
||||||
```
|
```
|
||||||
in your *python environment*.
|
|
||||||
|
in your _python environment_.
|
||||||
We note that pytest is part of the optional-dependencies `[dev]` of the plugin package.
|
We note that pytest is part of the optional-dependencies `[dev]` of the plugin package.
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
Tests in this package should be stored in the `tests` directory.
|
Tests in this package should be stored in the `tests` directory.
|
||||||
We suggest to sort tests of different submodules, i.e. `scans` or `devices` in the respective folder structure, and to folow a naming convention of `<test_module_name.py>`.
|
We suggest to sort tests of different submodules, i.e. `scans` or `devices` in the respective folder structure, and to folow a naming convention of `<test_module_name.py>`.
|
||||||
|
It is mandatory for test files to begin with `test_` for pytest to discover them.
|
||||||
|
|
||||||
To run all tests, navigate to the directory of the plugin from the command line, and run the command
|
To run all tests, navigate to the directory of the plugin from the command line, and run the command
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pytest -v --random-order ./tests
|
pytest -v --random-order ./tests
|
||||||
```
|
```
|
||||||
|
|
||||||
Note, the python environment needs to be active.
|
Note, the python environment needs to be active.
|
||||||
The additional arg `-v` allows pytest to run in verbose mode which provides more detailed information about the tests being run.
|
The additional arg `-v` allows pytest to run in verbose mode which provides more detailed information about the tests being run.
|
||||||
The argument `--random-order` instructs pytest to run the tests in random order, which is the default in the CI pipelines.
|
The argument `--random-order` instructs pytest to run the tests in random order, which is the default in the CI pipelines.
|
||||||
@ -28,4 +32,3 @@ Writing tests can be quite specific for the given function.
|
|||||||
We recommend writing tests as isolated as possible, i.e. try to test single functions instead of full classes.
|
We recommend writing tests as isolated as possible, i.e. try to test single functions instead of full classes.
|
||||||
A very useful class to enable isolated testing is [MagicMock](https://docs.python.org/3/library/unittest.mock.html).
|
A very useful class to enable isolated testing is [MagicMock](https://docs.python.org/3/library/unittest.mock.html).
|
||||||
In addition, we also recommend to take a look at the [How-to guides from pytest](https://docs.pytest.org/en/8.0.x/how-to/index.html).
|
In addition, we also recommend to take a look at the [How-to guides from pytest](https://docs.pytest.org/en/8.0.x/how-to/index.html).
|
||||||
|
|
||||||
|
@ -1,23 +1,27 @@
|
|||||||
# Getting Started with Testing using pytest
|
# Getting Started with Testing using pytest
|
||||||
|
|
||||||
BEC is using the [pytest](https://docs.pytest.org/en/8.0.x/) framework.
|
BEC is using the [pytest](https://docs.pytest.org/en/latest/) framework.
|
||||||
It can be install via
|
It can be installed via
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install pytest
|
pip install pytest
|
||||||
```
|
```
|
||||||
in your *python environment*.
|
|
||||||
|
in your _python environment_.
|
||||||
We note that pytest is part of the optional-dependencies `[dev]` of the plugin package.
|
We note that pytest is part of the optional-dependencies `[dev]` of the plugin package.
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
Tests in this package should be stored in the `tests` directory.
|
Tests in this package should be stored in the `tests` directory.
|
||||||
We suggest to sort tests of different submodules, i.e. `scans` or `devices` in the respective folder structure, and to folow a naming convention of `<test_module_name.py>`.
|
We suggest to sort tests of different submodules, i.e. `scans` or `devices` in the respective folder structure, and to folow a naming convention of `<test_module_name.py>`.
|
||||||
|
It is mandatory for test files to begin with `test_` for pytest to discover them.
|
||||||
|
|
||||||
To run all tests, navigate to the directory of the plugin from the command line, and run the command
|
To run all tests, navigate to the directory of the plugin from the command line, and run the command
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pytest -v --random-order ./tests
|
pytest -v --random-order ./tests
|
||||||
```
|
```
|
||||||
|
|
||||||
Note, the python environment needs to be active.
|
Note, the python environment needs to be active.
|
||||||
The additional arg `-v` allows pytest to run in verbose mode which provides more detailed information about the tests being run.
|
The additional arg `-v` allows pytest to run in verbose mode which provides more detailed information about the tests being run.
|
||||||
The argument `--random-order` instructs pytest to run the tests in random order, which is the default in the CI pipelines.
|
The argument `--random-order` instructs pytest to run the tests in random order, which is the default in the CI pipelines.
|
||||||
@ -28,4 +32,3 @@ Writing tests can be quite specific for the given function.
|
|||||||
We recommend writing tests as isolated as possible, i.e. try to test single functions instead of full classes.
|
We recommend writing tests as isolated as possible, i.e. try to test single functions instead of full classes.
|
||||||
A very useful class to enable isolated testing is [MagicMock](https://docs.python.org/3/library/unittest.mock.html).
|
A very useful class to enable isolated testing is [MagicMock](https://docs.python.org/3/library/unittest.mock.html).
|
||||||
In addition, we also recommend to take a look at the [How-to guides from pytest](https://docs.pytest.org/en/8.0.x/how-to/index.html).
|
In addition, we also recommend to take a look at the [How-to guides from pytest](https://docs.pytest.org/en/8.0.x/how-to/index.html).
|
||||||
|
|
||||||
|
@ -1,23 +1,27 @@
|
|||||||
# Getting Started with Testing using pytest
|
# Getting Started with Testing using pytest
|
||||||
|
|
||||||
BEC is using the [pytest](https://docs.pytest.org/en/8.0.x/) framework.
|
BEC is using the [pytest](https://docs.pytest.org/en/latest/) framework.
|
||||||
It can be install via
|
It can be installed via
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install pytest
|
pip install pytest
|
||||||
```
|
```
|
||||||
in your *python environment*.
|
|
||||||
|
in your _python environment_.
|
||||||
We note that pytest is part of the optional-dependencies `[dev]` of the plugin package.
|
We note that pytest is part of the optional-dependencies `[dev]` of the plugin package.
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
Tests in this package should be stored in the `tests` directory.
|
Tests in this package should be stored in the `tests` directory.
|
||||||
We suggest to sort tests of different submodules, i.e. `scans` or `devices` in the respective folder structure, and to folow a naming convention of `<test_module_name.py>`.
|
We suggest to sort tests of different submodules, i.e. `scans` or `devices` in the respective folder structure, and to folow a naming convention of `<test_module_name.py>`.
|
||||||
|
It is mandatory for test files to begin with `test_` for pytest to discover them.
|
||||||
|
|
||||||
To run all tests, navigate to the directory of the plugin from the command line, and run the command
|
To run all tests, navigate to the directory of the plugin from the command line, and run the command
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pytest -v --random-order ./tests
|
pytest -v --random-order ./tests
|
||||||
```
|
```
|
||||||
|
|
||||||
Note, the python environment needs to be active.
|
Note, the python environment needs to be active.
|
||||||
The additional arg `-v` allows pytest to run in verbose mode which provides more detailed information about the tests being run.
|
The additional arg `-v` allows pytest to run in verbose mode which provides more detailed information about the tests being run.
|
||||||
The argument `--random-order` instructs pytest to run the tests in random order, which is the default in the CI pipelines.
|
The argument `--random-order` instructs pytest to run the tests in random order, which is the default in the CI pipelines.
|
||||||
@ -28,4 +32,3 @@ Writing tests can be quite specific for the given function.
|
|||||||
We recommend writing tests as isolated as possible, i.e. try to test single functions instead of full classes.
|
We recommend writing tests as isolated as possible, i.e. try to test single functions instead of full classes.
|
||||||
A very useful class to enable isolated testing is [MagicMock](https://docs.python.org/3/library/unittest.mock.html).
|
A very useful class to enable isolated testing is [MagicMock](https://docs.python.org/3/library/unittest.mock.html).
|
||||||
In addition, we also recommend to take a look at the [How-to guides from pytest](https://docs.pytest.org/en/8.0.x/how-to/index.html).
|
In addition, we also recommend to take a look at the [How-to guides from pytest](https://docs.pytest.org/en/8.0.x/how-to/index.html).
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user