Skip to content

Commit 4a5c071

Browse files
authored
Disable failing test in CI as remote client/server not available (#153)
1 parent 0771660 commit 4a5c071

File tree

1 file changed

+30
-7
lines changed

1 file changed

+30
-7
lines changed

rewrite-python/src/test/java/org/openrewrite/python/PythonParserTest.java

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,50 @@
1515
*/
1616
package org.openrewrite.python;
1717

18+
import org.assertj.core.api.SoftAssertions;
1819
import org.junit.jupiter.api.Test;
20+
import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;
21+
import org.openrewrite.ParseExceptionResult;
22+
import org.openrewrite.SourceFile;
1923
import org.openrewrite.python.tree.Py;
2024
import org.openrewrite.test.RewriteTest;
2125

22-
import static org.assertj.core.api.Assertions.assertThat;
2326
import static org.openrewrite.python.Assertions.python;
2427

28+
@DisabledIfEnvironmentVariable(named = "CI", matches = "true", disabledReason = "No remote client/server available")
2529
class PythonParserTest implements RewriteTest {
2630

2731
@Test
2832
void parseString() {
2933
rewriteRun(
3034
python(
3135
"""
32-
import sys
33-
print(sys.path)
34-
""",
35-
spec -> spec.afterRecipe(cu -> {
36-
assertThat(cu).isInstanceOf(Py.CompilationUnit.class);
37-
})
36+
import sys
37+
print(sys.path)
38+
""",
39+
spec -> spec.afterRecipe(cu -> SoftAssertions.assertSoftly(softly -> {
40+
softly.assertThat(cu).isInstanceOf(Py.CompilationUnit.class);
41+
softly.assertThat(cu.getMarkers().getMarkers()).isEmpty();
42+
})
43+
)
3844
)
3945
);
4046
}
47+
48+
@Test
49+
void parseStringWithParser() {
50+
SourceFile sf = PythonParser.builder().build()
51+
.parse(
52+
//language=python
53+
"""
54+
import sys
55+
print(sys.path)
56+
""")
57+
.findFirst()
58+
.get();
59+
SoftAssertions.assertSoftly(softly -> {
60+
softly.assertThat(sf).isInstanceOf(Py.CompilationUnit.class);
61+
softly.assertThat(sf.getMarkers().getMarkers()).isEmpty();
62+
});
63+
}
4164
}

0 commit comments

Comments
 (0)