diff --git a/python/gen/com/jetbrains/commandInterface/commandLine/_CommandLineLexer.java b/python/gen/com/jetbrains/commandInterface/commandLine/_CommandLineLexer.java index fb7fb5410633..66dc6bbf61f0 100644 --- a/python/gen/com/jetbrains/commandInterface/commandLine/_CommandLineLexer.java +++ b/python/gen/com/jetbrains/commandInterface/commandLine/_CommandLineLexer.java @@ -112,7 +112,7 @@ public class _CommandLineLexer implements FlexLexer { /* The ZZ_CMAP_A table has 3088 entries */ static final char ZZ_CMAP_A[] = zzUnpackCMap( - "\11\0\5\2\22\0\1\2\1\0\1\14\4\0\1\15\5\0\1\10\2\7\12\12\1\6\2\0\1\16\3\0\32"+ + "\11\0\5\2\22\0\1\2\1\7\1\14\4\0\1\15\5\0\1\10\2\7\12\12\1\6\2\0\1\16\3\0\32"+ "\5\1\0\1\6\2\0\1\4\13\5\3\0\1\13\6\0\1\1\12\0\1\1\11\0\1\3\12\0\1\3\4\0\1"+ "\3\5\0\27\3\1\0\12\3\4\0\14\3\16\0\5\3\7\0\1\3\1\0\1\3\1\0\5\3\1\0\2\3\2\0"+ "\4\3\1\0\1\3\6\0\1\3\1\0\3\3\1\0\1\3\1\0\4\3\1\0\23\3\1\0\13\3\10\0\6\3\1"+ diff --git a/python/src/com/jetbrains/commandInterface/commandLine/_CommandLineLexer.flex b/python/src/com/jetbrains/commandInterface/commandLine/_CommandLineLexer.flex index 21b90331e648..d75b0ad64835 100644 --- a/python/src/com/jetbrains/commandInterface/commandLine/_CommandLineLexer.flex +++ b/python/src/com/jetbrains/commandInterface/commandLine/_CommandLineLexer.flex @@ -26,15 +26,15 @@ EOL=\R WHITE_SPACE=\s+ SPACE=[ \t\n\x0B\f\r]+ -LITERAL_STARTS_FROM_LETTER=[:letter:]([a-zA-Z_0-9]|:|\\|"/"|\.|-)* -LITERAL_STARTS_FROM_DIGIT=[:digit:]([a-zA-Z_0-9]|:|\\|"/"|\.|-)* -LITERAL_STARTS_FROM_SYMBOL=([/\~\.]([a-zA-Z_0-9]|:|\\|"/"|\.|-)*) -SPACED_LITERAL_STARTS_FROM_LETTER=\"[:letter:]([a-zA-Z_0-9]|:|\\|"/"|\.|-|[ \t\n\x0B\f\r])*\" -SPACED_LITERAL_STARTS_FROM_DIGIT=\"[:digit:]([a-zA-Z_0-9]|:|\\|"/"|\.|-|[ \t\n\x0B\f\r])*\" -SPACED_LITERAL_STARTS_FROM_SYMBOL=\"([/\~\.]([a-zA-Z_0-9]|:|\\|"/"|\.|-|[ \t\n\x0B\f\r])*)\" -SINGLE_Q_SPACED_LITERAL_STARTS_FROM_LETTER='[:letter:]([a-zA-Z_0-9]|:|\\|"/"|\.|-|[ \t\n\x0B\f\r])*' -SINGLE_Q_SPACED_LITERAL_STARTS_FROM_DIGIT='[:digit:]([a-zA-Z_0-9]|:|\\|"/"|\.|-|[ \t\n\x0B\f\r])*' -SINGLE_Q_SPACED_LITERAL_STARTS_FROM_SYMBOL='([/\~\.]([a-zA-Z_0-9]|:|\\|"/"|\.|-|[ \t\n\x0B\f\r])*)' +LITERAL_STARTS_FROM_LETTER=[:letter:]([a-zA-Z_0-9]|:|\\|"/"|\.|-|\!)* +LITERAL_STARTS_FROM_DIGIT=[:digit:]([a-zA-Z_0-9]|:|\\|"/"|\.|-|\!)* +LITERAL_STARTS_FROM_SYMBOL=([/\~\.!]([a-zA-Z_0-9]|:|\\|"/"|\.|-|\!)*) +SPACED_LITERAL_STARTS_FROM_LETTER=\"[:letter:]([a-zA-Z_0-9]|:|\\|"/"|\.|-|[ \t\n\x0B\f\r]|\!)*\" +SPACED_LITERAL_STARTS_FROM_DIGIT=\"[:digit:]([a-zA-Z_0-9]|:|\\|"/"|\.|-|[ \t\n\x0B\f\r]|\!)*\" +SPACED_LITERAL_STARTS_FROM_SYMBOL=\"([/\~\.!]([a-zA-Z_0-9]|:|\\|"/"|\.|-|[ \t\n\x0B\f\r]|\!)*)\" +SINGLE_Q_SPACED_LITERAL_STARTS_FROM_LETTER='[:letter:]([a-zA-Z_0-9]|:|\\|"/"|\.|-|[ \t\n\x0B\f\r]|\!)*' +SINGLE_Q_SPACED_LITERAL_STARTS_FROM_DIGIT='[:digit:]([a-zA-Z_0-9]|:|\\|"/"|\.|-|[ \t\n\x0B\f\r]|\!)*' +SINGLE_Q_SPACED_LITERAL_STARTS_FROM_SYMBOL='([/\~\.!]([a-zA-Z_0-9]|:|\\|"/"|\.|-|[ \t\n\x0B\f\r]|\!)*)' SHORT_OPTION_NAME_TOKEN=-[:letter:] LONG_OPTION_NAME_TOKEN=--[:letter:](-|[a-zA-Z_0-9])* diff --git a/python/src/com/jetbrains/commandInterface/commandLine/command_line.bnf b/python/src/com/jetbrains/commandInterface/commandLine/command_line.bnf index d007fa9c9666..072f69405e35 100644 --- a/python/src/com/jetbrains/commandInterface/commandLine/command_line.bnf +++ b/python/src/com/jetbrains/commandInterface/commandLine/command_line.bnf @@ -25,18 +25,18 @@ tokens=[ space='regexp:\s+' // WARNING: Comment out or remove this (space) before generating Flex file! It is here only for live preview. EQ = '=' - LITERAL_STARTS_FROM_LETTER='regexp:\p{Alpha}(\w|:|\\|/|\.|-)*' - LITERAL_STARTS_FROM_DIGIT='regexp:\p{Digit}(\w|:|\\|/|\.|-)*' - LITERAL_STARTS_FROM_SYMBOL='regexp:([/\~\.](\w|:|\\|/|\.|-)*)' + LITERAL_STARTS_FROM_LETTER='regexp:\p{Alpha}(\w|:|\\|/|\.|-|\!)*' + LITERAL_STARTS_FROM_DIGIT='regexp:\p{Digit}(\w|:|\\|/|\.|-|\!)*' + LITERAL_STARTS_FROM_SYMBOL='regexp:([/\~\.!](\w|:|\\|/|\.|-|\!)*)' - SPACED_LITERAL_STARTS_FROM_LETTER='regexp:"\p{Alpha}(\w|:|\\|/|\.|-|\s)*"' - SPACED_LITERAL_STARTS_FROM_DIGIT='regexp:"\p{Digit}(\w|:|\\|/|\.|-|\s)*"' - SPACED_LITERAL_STARTS_FROM_SYMBOL='regexp:"([/\~\.](\w|:|\\|/|\.|-|\s)*)"' + SPACED_LITERAL_STARTS_FROM_LETTER='regexp:"\p{Alpha}(\w|:|\\|/|\.|-|\s|\!)*"' + SPACED_LITERAL_STARTS_FROM_DIGIT='regexp:"\p{Digit}(\w|:|\\|/|\.|-|\s|\!)*"' + SPACED_LITERAL_STARTS_FROM_SYMBOL='regexp:"([/\~\.!](\w|:|\\|/|\.|-|\s|\!)*)"' - SINGLE_Q_SPACED_LITERAL_STARTS_FROM_LETTER="regexp:'\p{Alpha}(\w|:|\\|/|\.|-|\s)*'" - SINGLE_Q_SPACED_LITERAL_STARTS_FROM_DIGIT="regexp:'\p{Digit}(\w|:|\\|/|\.|-|\s)*'" - SINGLE_Q_SPACED_LITERAL_STARTS_FROM_SYMBOL="regexp:'([/\~\.](\w|:|\\|/|\.|-|\s)*)'" + SINGLE_Q_SPACED_LITERAL_STARTS_FROM_LETTER="regexp:'\p{Alpha}(\w|:|\\|/|\.|-|\s|\!)*'" + SINGLE_Q_SPACED_LITERAL_STARTS_FROM_DIGIT="regexp:'\p{Digit}(\w|:|\\|/|\.|-|\s|\!)*'" + SINGLE_Q_SPACED_LITERAL_STARTS_FROM_SYMBOL="regexp:'([/\~\.!](\w|:|\\|/|\.|-|\s|\!)*)'" diff --git a/python/testData/testRunner/env/nose/test_with_slow/test_with_slow.py b/python/testData/testRunner/env/nose/test_with_slow/test_with_slow.py new file mode 100644 index 000000000000..fbccf0507e42 --- /dev/null +++ b/python/testData/testRunner/env/nose/test_with_slow/test_with_slow.py @@ -0,0 +1,8 @@ +from nose.plugins.attrib import attr + +def test_fast(): + pass + +@attr('slow') +def test_Slow(): + pass \ No newline at end of file diff --git a/python/testSrc/com/jetbrains/env/python/testing/PythonNoseTestingTest.java b/python/testSrc/com/jetbrains/env/python/testing/PythonNoseTestingTest.java index abd1870f47b0..839ee3ede14a 100644 --- a/python/testSrc/com/jetbrains/env/python/testing/PythonNoseTestingTest.java +++ b/python/testSrc/com/jetbrains/env/python/testing/PythonNoseTestingTest.java @@ -6,11 +6,14 @@ import com.jetbrains.env.PyEnvTestCase; import com.jetbrains.env.PyProcessWithConsoleTestTask; import com.jetbrains.env.python.testing.CreateConfigurationTestTask.PyConfigurationCreationTask; import com.jetbrains.env.ut.PyNoseTestProcessRunner; +import com.jetbrains.env.ut.PyTestTestProcessRunner; import com.jetbrains.python.sdkTools.SdkCreationType; import com.jetbrains.python.testing.PythonTestConfigurationsModel; import com.jetbrains.python.testing.universalTests.PyUniversalNoseTestConfiguration; import com.jetbrains.python.testing.universalTests.PyUniversalNoseTestFactory; +import com.jetbrains.python.testing.universalTests.PyUniversalPyTestConfiguration; import org.jetbrains.annotations.NotNull; +import org.junit.Assert; import org.junit.Test; import java.io.IOException; @@ -23,6 +26,41 @@ import static org.junit.Assert.assertEquals; @EnvTestTagsRequired(tags = "nose") public final class PythonNoseTestingTest extends PyEnvTestCase { + + // Ensure slow test is not run when --attr="!slow" is provided + @Test + public void testMarkerWithSlow() throws Exception { + runPythonTest( + new PyProcessWithConsoleTestTask("/testRunner/env/nose/test_with_slow", SdkCreationType.EMPTY_SDK) { + + @NotNull + @Override + protected PyNoseTestProcessRunner createProcessRunner() throws Exception { + return new PyNoseTestProcessRunner("test_with_slow.py", 0) { + @Override + protected void configurationCreatedAndWillLaunch(@NotNull PyUniversalNoseTestConfiguration configuration) throws IOException { + super.configurationCreatedAndWillLaunch(configuration); + configuration.setAdditionalArguments("--attr=\"!slow\""); + } + }; + } + + + @Override + protected void checkTestResults(@NotNull PyNoseTestProcessRunner runner, + @NotNull String stdout, + @NotNull String stderr, + @NotNull String all) { + Assert.assertEquals("--slow runner borken", "Test tree:\n" + + "[root]\n" + + ".test_with_slow\n" + + "..test_fast(+)\n", + runner.getFormattedTestTree()); + } + }); + } + + @Test public void testMultipleCases() throws Exception { runPythonTest(