question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to override multiple arguments with same key with -o/--override-ini?

See original GitHub issue

this is my pytest.ini

[pytest]
python_files = test_*
python_classes = Test*
python_functions = test_*
addopts = --tc-file=configurations/utenze/andrea-integration.ini --tc-file=configurations/puntamenti/integration.ini

there are two --tc-fle parameters used by https://pypi.org/project/pytest-testconfig/

i would like o overwrite theme using -o

i tried

pytest -o --tc-file=configurations/utenze/andrea-integration.ini --tc-file=configurations/puntamenti/legaltest.ini

i obtain

pytest: error: argument -o/--override-ini: expected one argument

i tried

pytest -o --tc-file=configurations/utenze/andrea-integration.ini -o --tc-file=configurations/puntamenti/legaltest.ini

i obtain the same result.

i can fix the issue creating different .ini file and use -c to load the configuration, but how i can overwrite parameters with same key?

thanks.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
andreabisellocommented, Jan 15, 2020

in order to understand what is going on, in my conftest.py i put this

def pytest_configure(config):
    
    parameters = config.option.testconfig

    if parameters is not None:
        for param in parameters:
            if param is not None:
                print("parametro -> " + param)

my pytest.ini file contains

addopts = --tc-file=configurations/utenze/andrea-integration.ini --tc-file=configurations/puntamenti/integration.ini my cli command is

pytest --tc-file=configurations/utenze/giordano-integration.ini --tc-file=configurations/puntamenti/integration.ini running i obtain

parametro -> configurations/utenze/andrea-integration.ini
parametro -> configurations/puntamenti/integration.ini
parametro -> configurations/utenze/giordano-integration.ini
parametro -> configurations/puntamenti/integration.ini

so i understand there are 4 parameters loading : 2 in pytest.ini e 2 in the command line.

my use case is to keep a pytest.ini for running with pycharm and override configuration for continous integration running, selecting the configuration of several environment and users running tests.

so my use case can be solved in a different way , i only need o understand well how to use these parameters.

1reaction
RonnyPfannschmidtcommented, Jan 15, 2020

append cli parameters cannot be overridden by the “ini override”

you need to add a own cli parameter which resets the list

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overriding a method with more parameters in java?
Currently, my solution is using optional parameters : class B extends A { public execute(int a, Object.
Read more >
Override parameters on stack instances - AWS CloudFormation
You can override template parameter values when you first create the stack instances, and you can override parameter values for existing stack instances....
Read more >
6.2 Creating Classes - Racket Documentation
Unused (by-name) arguments are to be propagated to the superclass, as described in Creating Objects. Multiple initialization arguments can use the same name...
Read more >
Scala | Field Overriding - GeeksforGeeks
In order to execute a Field Overriding, we need to override variables that are declared utilizing only the val keyword in both super...
Read more >
Overriding and Hiding Methods (The Java™ Tutorials ...
The overriding method has the same name, number and type of parameters, and return type as the method that it overrides. An overriding...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found