feat: force enable socket CLI flag#186
Conversation
326cdbb to
70c479e
Compare
|
Hi @mgaitan ! This behavior exists in Have you tried your scenario with |
|
disabling the plugin causes the default arguments I already have in pyproject.toml to be unknown and it cannot be executed. |
|
@mgaitan Thanks for describing your use case. It sounds like the way I'd handle this would be to remove the socket parameters from the config file, and selectively add the |
|
@miketheman Please reconsider this. This is not a strange pattern in command line applications at all. Actually, many applications honor an environment variable for an argument, but disregard the environment variable in case the argument is explicitly passed. To give you a closer and more concrete example related to pytest. In our suite we use pytest-vcr [1] to "cache" HTTP interactions of our tests and avoid relying on the internet. In our which is the recommended way to make CI fails if a test is making a request that is not considered in the cassette. However, when we need to record a new cassette (or update an existing one) this setting should be "overloaded'' and is simply done by passing So basically, [1] Actually this is the reason why I needed to implementd this change. As we are using both pytest-vcr and pytest-socket, whenever I need to record a new cassette I need to allow that internet access. So I want to override both the socket disabling and vcr-record=none on that single pytest execution from CLI. |
|
@mgaitan Thanks for the deeper explanation - that use case makes a lot more sense. That context might have been useful at the outset to prevent the back and forth. 😄 In this case, I think the CLI arg should reflect what is actually happening, so possibly |
70c479e to
495ce5b
Compare
495ce5b to
8b07ef4
Compare
|
Code Climate has analyzed commit 8b07ef4 and detected 0 issues on this pull request. View more on Code Climate. |
|
@miketheman I picked |
I need to have sockets disabled by default in pyproject.yml but still be able to override it from the command line.
so
pytest --force-enable-sockettakes precedence even when pyproject.yml has