Add an ID to each instance of behave #121
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context of the Pull Request
The system I want to test can only be accessed by a single entity at a time. Therefore, to conduct tests in parallel, I need to have as many instances of my system as there are instances of Behave. Additionally, each instance of Behave must access a unique instance of the system. Otherwise, the test results will be random.
A simple solution to this problem is to assign a different instance of the system to each instance of Behave. However, this implies knowing, from the Python code of the tests, in which instance of Behave we are currently located.
Currently, the only way (that I have found) to distinguish Behave processes is by looking at the output file used by the Behave instance (E.g
behave.log
,stdout1.txt
,stdout2.txt
, ...). Not only is this approach inelegant, but it is also unreliable. For example, when invoking BehaveX with 2 processes, in some cases, the output files will bestdout1.txt
,stdout2.txt,
and in other cases, the output files will bestdout2.txt,
stdout3.txt.
Goal of the Pull Request
The purpose of this pull request is to assign an ID to each instance of Behave. The ID is unique and ranges from 0 to the number of processes -1.
The ID is passed to each Behave instance through the '-D' parameter of Behave.
This ID is then accessible in the context of each instance.
E.g
Thank you for this great project. If you have any questions, do not hesitate to ask for more details