Skip to content

Split out test-phases from PR validation into YAML step-template #4781

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/ci/templates/test_phases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ steps:

# Show all versions installed/available on PATH if in verbose mode.
# Example command line (windows pwsh):
# > Write-Host Node ver: $(& node -v) NPM Ver: $(& npm -v) Python ver: $(& python --version)"
# > Write-Host "Node ver: $(& node -v) NPM Ver: $(& npm -v) Python ver: $(& python --version)"
- bash: |
echo AVAILABLE DEPENDENCY VERSIONS
echo Node Version = `node -v`
Expand Down
27 changes: 11 additions & 16 deletions pythonFiles/tests/test_normalize_for_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,30 @@
class TestNormalizationScript(object):
"""Basic unit tests for the normalization script."""


@pytest.mark.skipif(sys.version_info.major == 2,
reason="normalizeForInterpreter not working for 2.7, see GH #4805")
reason="normalizeForInterpreter not working for 2.7, see GH #4805")
def test_basicNormalization(self, capsys):
src = 'print("this is a test")'
normalizeForInterpreter.normalize_lines(src)
captured = capsys.readouterr()
assert captured.out == src


@pytest.mark.skipif(sys.version_info.major == 2,
reason="normalizeForInterpreter not working for 2.7, see GH #4805")
reason="normalizeForInterpreter not working for 2.7, see GH #4805")
def test_moreThanOneLine(self, capsys):
src = textwrap.dedent("""\
# Some rando comment

def show_something():
print("Something")
"""
)
)
normalizeForInterpreter.normalize_lines(src)
captured = capsys.readouterr()
assert captured.out == src


@pytest.mark.skipif(sys.version_info.major == 2,
reason="normalizeForInterpreter not working for 2.7, see GH #4805")
reason="normalizeForInterpreter not working for 2.7, see GH #4805")
def test_withHangingIndent(self, capsys):
src = textwrap.dedent("""\
x = 22
Expand All @@ -48,14 +45,13 @@ def test_withHangingIndent(self, capsys):
if result == 42:
print("The answer to life, the universe, and everything")
"""
)
)
normalizeForInterpreter.normalize_lines(src)
captured = capsys.readouterr()
assert captured.out == src


@pytest.mark.skipif(sys.version_info.major == 2,
reason="normalizeForInterpreter not working for 2.7, see GH #4805")
reason="normalizeForInterpreter not working for 2.7, see GH #4805")
def test_clearOutExtraneousNewlines(self, capsys):
src = textwrap.dedent("""\
value_x = 22
Expand All @@ -67,22 +63,21 @@ def test_clearOutExtraneousNewlines(self, capsys):
print(value_x + value_y + value_z)

"""
)
)
expectedResult = textwrap.dedent("""\
value_x = 22
value_y = 30
value_z = -10
print(value_x + value_y + value_z)

"""
)
)
normalizeForInterpreter.normalize_lines(src)
result = capsys.readouterr()
assert result.out == expectedResult


@pytest.mark.skipif(sys.version_info.major == 2,
reason="normalizeForInterpreter not working for 2.7, see GH #4805")
reason="normalizeForInterpreter not working for 2.7, see GH #4805")
def test_clearOutExtraLinesAndWhitespace(self, capsys):
src = textwrap.dedent("""\
if True:
Expand All @@ -95,7 +90,7 @@ def test_clearOutExtraLinesAndWhitespace(self, capsys):
print(x + y + z)

"""
)
)
expectedResult = textwrap.dedent("""\
if True:
x = 22
Expand All @@ -105,7 +100,7 @@ def test_clearOutExtraLinesAndWhitespace(self, capsys):
print(x + y + z)

"""
)
)
normalizeForInterpreter.normalize_lines(src)
result = capsys.readouterr()
assert result.out == expectedResult