-
Hi! I'm currently having dozens of environment YAMLs lying around each with the default target called I want to put them all in one big file and let the targets name be more useful. I've seen this here https://labgrid.readthedocs.io/en/latest/configuration.html#environment-configuration Now my question: How would i select the right target when running pytest? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
If you want to test with multiple targets in one pytest you'll need to provide your own fixtures for the additional targets. |
Beta Was this translation helpful? Give feedback.
-
Hi @siredmar, I have a similar experience as @Emantor describes. Generally, you need to extract the necessary drivers/resources from the config YAML for the relevant target and further process them in fixtures, which are then used in the tests. I can share a piece of code that I recently used in a more complex setup.
Where pytest was called by
|
Beta Was this translation helpful? Give feedback.
-
@ca-ja thanks for your answer! I think we are kind of on the same page here. What i don't understand right is the thing with the driver replacements... Can you elaborate a little more? Thanks! |
Beta Was this translation helpful? Give feedback.
-
Alright folks, i got it working. Maybe this help other people facing similar issues. The use caseWe are having multiple devices we want to run tests on. Each device is independent and does not run tests together with other devices. So we decided to have a 1:1 relationship between a remote place and a DUT and also a 1:1 between a remote place and a target. The goalThe goal is to have one big file of targets. We use labgrid in multiple repos we want to run tests in with the CI. So keeping track of one file is way more simple instead of having dozens of files that needs to be kept in sync among several repos. How to run devices on a group of devices?Using tags we group together a set of places and therefore DUTs, e.g. we have a testcase called
How does the config look like?There is no
However, running One can fix this by passing an environment variable e.g.
This reads the environment and returns the target from the one big file. The test itself isn't changed at all as the fixture returns the right target.
|
Beta Was this translation helpful? Give feedback.
Alright folks, i got it working. Maybe this help other people facing similar issues.
The use case
We are having multiple devices we want to run tests on. Each device is independent and does not run tests together with other devices. So we decided to have a 1:1 relationship between a remote place and a DUT and also a 1:1 between a remote place and a target.
The goal
The goal is to have one big file of targets. We use labgrid in multiple repos we want to run tests in with the CI. So keeping track of one file is way more simple instead of having dozens of files that needs to be kept in sync among several repos.
How to run devices on a group of devices?
Using tags we group together a set of p…