Questions tagged [conftest]
56 questions
0
votes
0 answers
Unittest test not using correct config file specified in the conftest.py
I have in my conftest.py a container (dependency injector) which "patches" over my prod config.yaml with a test.yaml. This is initialised in the conftest.py module, like so:
@pytest.fixture(scope="session")
def test_initialize():
test_container…

pymat
- 1,090
- 1
- 23
- 45
0
votes
0 answers
REGA OPA don't add duplicate values to array
I am trying to do validations , some duplicate keys should not be available in yaml object,
so when I am trying to add the values in array it behaves like set and removes the duplicates.
I wanted to find out the duplicate key .
test:
- name :…

Sushant Sharma
- 1
- 2
0
votes
0 answers
pytest_session_finish is not called when it is in a conftest above the test suite and there is a local coftest
My problem is this
I have a project of multiple tests all sitting under a root folder
Root -> Folder1
Root -> Folder2
etc
Root contains a conftest file with the sessionfinish hook
def pytest_sessionfinish(session, exitstatus):
each of the other…

SteveR
- 13
- 1
- 4
0
votes
2 answers
How to best structure conftest and fixtures in across multiple pytest files
Let's say I have 3 lists of DataFrames containing different data that I want to run the same test cases on. How do I best structure my files and code so that I have one conftest.py (or some sort of parent class) that contains all the test cases that…

javierlu
- 3
- 2
0
votes
1 answer
Rego policy for Kubernets label with /
I'm trying to write some Rego policies to enforce some company labels on our Kubernetes objects, and I'm struggling to get the right syntax for labels that have an additional slash (/) or periods (.) in them.
An example label would be:
metadata:
…

NA Slacker
- 843
- 6
- 12
- 24
0
votes
0 answers
Why pytest can't see conftest which is located in virtual environment
I need to implement the logic of conftest not in the project inside but in separate package which I want to put in my virtual env. How can I make it possible? For now I have conftest in separate package where I already implement the simple logic…

Micky
- 3
- 4
0
votes
1 answer
OPA/Rego: Ensure that every Service in Helm chart has exactly one matching Pod
I would like to check that every Service in a rendered Helm chart has exactly one matching Pod.
A Pod to service association exists when every entry specified in a Services spec.selector object is reflected in a Pods metadata.labels object (which…

Codepunkt
- 532
- 4
- 15
0
votes
1 answer
Adding multiple XML attributes to a pytest xml in conftest.py
I have multiple pytest scripts that run independently, I want to build a mechanism to add xml attributes to the tests in the script to run in the conftest.py script on collection.
So far i've found online a call…

Bored002
- 353
- 6
- 18
0
votes
2 answers
Collecting all the tests implemented in pytest along with markers
I am looking forward to list all the (pytest) test cases in the form of CSV.
Use case scenario:
We already have test cases defined for multiple platforms and databases. These test cases are organized/grouped based on different markers (Ex :…

sandy_1111
- 233
- 3
- 13
0
votes
0 answers
How to invoke manually fixures in conftest
in my piece of code had several fixures which is running in session scope, and some fixure that is running each test (autouse=true) which is checking some condition and if the condition is true than call again to fixure which is in this case defined…

Andrey Tupikov
- 3
- 2
0
votes
1 answer
how to launch seperate browser for each test in python selenium
while running test_login.py , 3 browsers should be launched and verify the tests but only one is getting launched and second test is failing as second is continuing after first test steps.
*********** Conftest.py********** below is conftest…

santosh kumar
- 21
- 5
0
votes
1 answer
Testing k8s ConfigMap with nested dbless config for Kong
I've found really problematic to test Kong's config which is nested in such ConfigMap (it is a short version of this ConfigMap):
apiVersion: v1
kind: ConfigMap
metadata:
name: "some_name"
data:
kong_config.yml: |
_format_version: "2.1"
…
0
votes
1 answer
Using contains in conftest rules
I have following XML (it is a dotnet project file:
And…

Piotr Stapp
- 19,392
- 11
- 68
- 116
0
votes
1 answer
Open Policy Agent - check existence of elements in a list
Just started to deal with conftest and OPA, I'm trying to validate a sample kubernetes deployment manifest to make sure it contains a specific key in a list (i.e. image exists for all containers)
here's a sample input
apiVersion: apps/v1
kind:…

Mahyar
- 1,011
- 2
- 17
- 37
0
votes
1 answer
How to read command line argument while running py.test -sv B/
I have a file conftest.py in directory A. I have some test files in directory B which is in A. I run all of them using py.test -sv B/. However sometime I want to pass argument -val="Hello" and store in a file.
I am trying to do it as…
user16092902