From 053c052190ef757a660c715c110e88a8e053ef04 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 1 Apr 2016 01:20:22 -0400 Subject: [PATCH] Always lstrip() keyword expression --- _pytest/mark.py | 2 +- testing/acceptance_test.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/_pytest/mark.py b/_pytest/mark.py index 1a7635402..d8b60def3 100644 --- a/_pytest/mark.py +++ b/_pytest/mark.py @@ -58,7 +58,7 @@ pytest_cmdline_main.tryfirst = True def pytest_collection_modifyitems(items, config): - keywordexpr = config.option.keyword + keywordexpr = config.option.keyword.lstrip() matchexpr = config.option.markexpr if not keywordexpr and not matchexpr: return diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 9bc3a191a..4e9645037 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -670,6 +670,11 @@ class TestDurations: "*call*test_1*", ]) + def test_with_not(self, testdir): + testdir.makepyfile(self.source) + result = testdir.runpytest("-k not 1") + assert result.ret == 0 + class TestDurationWithFixture: source = """