From 315cbd044749b588975625f2012e7408464a6901 Mon Sep 17 00:00:00 2001 From: "i.alexandrov" Date: Fri, 6 Feb 2026 16:06:47 +0300 Subject: [PATCH 1/4] [multiple_configs] Fix storage_type --- examples/multiple_configs/hardpy.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/multiple_configs/hardpy.toml b/examples/multiple_configs/hardpy.toml index 124a807e..0f1a9467 100644 --- a/examples/multiple_configs/hardpy.toml +++ b/examples/multiple_configs/hardpy.toml @@ -3,13 +3,13 @@ tests_name = "Multiple configs" current_test_config = "" [database] +storage_type = "couchdb" user = "dev" password = "dev" host = "localhost" port = 5984 [frontend] -storage_type = "couchdb" host = "localhost" port = 8000 language = "en" From a321c98134caea04f6ff105c3f58f1a11aea36c5 Mon Sep 17 00:00:00 2001 From: "i.alexandrov" Date: Fri, 6 Feb 2026 16:07:12 +0300 Subject: [PATCH 2/4] [docs] Add hardpy-config-file info --- docs/documentation/hardpy_config.md | 2 +- docs/documentation/pytest_hardpy.md | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/documentation/hardpy_config.md b/docs/documentation/hardpy_config.md index ac93f5a8..733e710f 100644 --- a/docs/documentation/hardpy_config.md +++ b/docs/documentation/hardpy_config.md @@ -286,7 +286,7 @@ extra_arg_2 = 2 ```python import hardpy -config = get_hardpy_config() +config = hardpy.get_hardpy_config() print(config.extra_args.["extra_arg_1"]) print(config.extra_args.["extra_arg_2"]) ``` diff --git a/docs/documentation/pytest_hardpy.md b/docs/documentation/pytest_hardpy.md index 3c91d8af..bf308f2e 100644 --- a/docs/documentation/pytest_hardpy.md +++ b/docs/documentation/pytest_hardpy.md @@ -1526,6 +1526,15 @@ The default is *False*. --sc-autosync ``` +#### hardpy-config-file + +The HardPy configuration file path ([hardpy.toml](./hardpy_config.md)). +The default is the tests path. + +```bash +--hardpy-config-file path/to/file/ +``` + #### hardpy-start-arg Dynamic arguments for test execution in key=value format. Can be specified multiple times. From 1129fef8bea4b7eb7a0e9f4de3c0972dfaf423ea Mon Sep 17 00:00:00 2001 From: "i.alexandrov" Date: Fri, 6 Feb 2026 16:08:37 +0300 Subject: [PATCH 3/4] [pytest_hardpy] Add --hardpy-config-file option --- hardpy/pytest_hardpy/plugin.py | 12 +++++++++++- hardpy/pytest_hardpy/pytest_wrapper.py | 4 ++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/hardpy/pytest_hardpy/plugin.py b/hardpy/pytest_hardpy/plugin.py index d4c4ffeb..1eb0a934 100644 --- a/hardpy/pytest_hardpy/plugin.py +++ b/hardpy/pytest_hardpy/plugin.py @@ -104,6 +104,11 @@ def pytest_addoption(parser: Parser) -> None: default=default_config.stand_cloud.autosync, help="StandCloud auto syncronization", ) + parser.addoption( + "--hardpy-config-file", + action="store", + help="HardPy configuration file path", + ) parser.addoption( "--hardpy-start-arg", action="append", @@ -151,7 +156,12 @@ def __init__(self) -> None: def pytest_configure(self, config: Config) -> None: """Configure pytest.""" config_manager = ConfigManager() - hardpy_config = config_manager.read_config(Path(config.rootpath)) + + hardpy_config_path = config.getoption("--hardpy-config-file") + if hardpy_config_path: + hardpy_config = config_manager.read_config(Path(hardpy_config_path)) + else: + hardpy_config = config_manager.read_config(Path(config.rootpath)) if not hardpy_config: hardpy_config = HardpyConfig() diff --git a/hardpy/pytest_hardpy/pytest_wrapper.py b/hardpy/pytest_hardpy/pytest_wrapper.py index f417c037..f47bcf08 100644 --- a/hardpy/pytest_hardpy/pytest_wrapper.py +++ b/hardpy/pytest_hardpy/pytest_wrapper.py @@ -76,6 +76,8 @@ def start( self._tests_name(), "--sc-address", self.config.stand_cloud.address, + "--hardpy-config-file", + str(self._config_manager.tests_path), ] if selected_tests: @@ -153,6 +155,8 @@ def collect( self.config.database.url, "--hardpy-tests-name", self._tests_name(), + "--hardpy-config-file", + str(self._config_manager.tests_path), "--hardpy-pt", ] From c6259be10949068466dd606e80149522bdfbe61c Mon Sep 17 00:00:00 2001 From: "i.alexandrov" Date: Fri, 6 Feb 2026 16:14:27 +0300 Subject: [PATCH 4/4] Update package to 0.22.1 --- docs/changelog.md | 7 +++++++ pyproject.toml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/changelog.md b/docs/changelog.md index 57ebf46c..d9260ea0 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +2,13 @@ Versions follow [Semantic Versioning](https://semver.org/): `..`. +## 0.22.1 + +* Add the `--hardpy-config-file` to the pytest plugin. + This feature enables tests to be run in a folder that is different + to the one containing the hardpy.toml file. + [[PR-259](https://github.com/everypinio/hardpy/pull/259)] + ## 0.22.0 * Add the `get_hardpy_function` to retrieve the current configuration from the **hardpy.toml**. diff --git a/pyproject.toml b/pyproject.toml index 3cfc4b44..54c8a7ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ [project] name = "hardpy" - version = "0.22.0" + version = "0.22.1" description = "HardPy library for device testing" license = "GPL-3.0-or-later" authors = [{ name = "Everypin", email = "info@everypin.io" }]