diff options
author | Ran Benita <ran@unusedvar.com> | 2020-05-11 15:44:01 +0300 |
---|---|---|
committer | Ran Benita <ran@unusedvar.com> | 2020-05-11 16:07:52 +0300 |
commit | c4f9eaa5de7db6dc23e4f8296f3504a8d684fca0 (patch) | |
tree | f7a12ff1c0988ecf8d4d0d4b3dd12f2a6f3d3c9c /src/_pytest/deprecated.py | |
parent | 5e7f1ab4bf58e473e5d7f878eb2b499d7deabd29 (diff) | |
download | pytest-c4f9eaa5de7db6dc23e4f8296f3504a8d684fca0.tar.gz |
mark: deprecate a couple undocumented -k syntaxes
The `-k '-expr'` syntax is an old alias to `-k 'not expr'`. It's also
not a very convenient to have syntax that start with `-` on the CLI.
Deprecate it and suggest replacing with `not`.
---
The `-k 'expr:'` syntax discards all items until the first match and
keeps all subsequent, e.g. `-k foo` with
test_bar
test_foo
test_baz
results in `test_foo`, `test_baz`. That's a bit weird, so deprecate it
without a replacement. If someone complains we can reconsider or devise
a better alternative.
Diffstat (limited to 'src/_pytest/deprecated.py')
-rw-r--r-- | src/_pytest/deprecated.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/_pytest/deprecated.py b/src/_pytest/deprecated.py index 8c9bd9d5c..9f4570f85 100644 --- a/src/_pytest/deprecated.py +++ b/src/_pytest/deprecated.py @@ -75,3 +75,13 @@ TERMINALWRITER_WRITER = PytestDeprecationWarning( "The TerminalReporter.writer attribute is deprecated, use TerminalReporter._tw instead at your own risk.\n" "See https://docs.pytest.org/en/latest/deprecations.html#terminalreporter-writer for more information." ) + + +MINUS_K_DASH = PytestDeprecationWarning( + "The `-k '-expr'` syntax to -k is deprecated.\nUse `-k 'not expr'` instead." +) + +MINUS_K_COLON = PytestDeprecationWarning( + "The `-k 'expr:'` syntax to -k is deprecated.\n" + "Please open an issue if you use this and want a replacement." +) |