Skip to content

Commit

Permalink
Remove testprojects/src/python/unicode/compilation_failure.
Browse files Browse the repository at this point in the history
Now `./pants lint ::` passes.

[ci skip-rust]

[ci skip-build-wheels]
  • Loading branch information
benjyw committed Feb 14, 2021
1 parent 64aa7db commit e454042
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 42 deletions.
3 changes: 0 additions & 3 deletions src/python/pants/base/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ python_integration_tests(
python_integration_tests(
name='exiter_integration_test',
sources=['exiter_integration_test.py'],
dependencies=[
'testprojects/src/python:unicode_directory',
],
uses_pants_run=True,
timeout=180,
)
34 changes: 25 additions & 9 deletions src/python/pants/base/exiter_integration_test.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from pants.testutil.pants_integration_test import ensure_daemon, run_pants
import os

from pants.testutil.pants_integration_test import ensure_daemon, run_pants, setup_tmpdir

dir_layout = {
# This file is expected to fail to "compile" when run via `./pants run` due to a SyntaxError.
# Because the error itself contains unicode, it can exercise that error handling codepaths
# are unicode aware.
os.path.join(
"exiter_integration_test_harness", "main.py"
): "if __name__ == '__main__':\n import sys¡",
os.path.join(
"exiter_integration_test_harness", "BUILD"
): "python_library()\npex_binary(name='bin', entry_point='main.py')",
}


@ensure_daemon
def test_unicode_containing_exception(use_pantsd: bool) -> None:
pants_run = run_pants(
[
"--backend-packages=pants.backend.python",
"run",
"testprojects/src/python/unicode/compilation_failure/main.py",
],
use_pantsd=use_pantsd,
)

with setup_tmpdir(dir_layout) as tmpdir:
pants_run = run_pants(
[
"--backend-packages=pants.backend.python",
"run",
os.path.join(tmpdir, "exiter_integration_test_harness", "main.py"),
],
use_pantsd=use_pantsd,
)
pants_run.assert_failure()
assert "import sys¡" in pants_run.stderr
6 changes: 0 additions & 6 deletions testprojects/src/python/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,3 @@ files(
name = 'sources_directory',
sources = ['sources/**/*'],
)

files(
name = 'unicode_directory',
sources = ['unicode/**/*'],
tags = {'nolint'},
)
4 changes: 0 additions & 4 deletions testprojects/src/python/unicode/BUILD

This file was deleted.

Empty file.
5 changes: 0 additions & 5 deletions testprojects/src/python/unicode/compilation_failure/BUILD

This file was deleted.

Empty file.
10 changes: 0 additions & 10 deletions testprojects/src/python/unicode/compilation_failure/main.py

This file was deleted.

20 changes: 15 additions & 5 deletions tests/python/pants_test/pantsd/pantsd_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from pants.testutil.pants_integration_test import (
PantsJoinHandle,
read_pantsd_log,
setup_tmpdir,
temporary_workdir,
)
from pants.util.contextutil import environment_as, temporary_dir, temporary_file
Expand Down Expand Up @@ -54,6 +55,14 @@ def join():
return join


compilation_failure_dir_layout = {
os.path.join("compilation_failure", "main.py"): "if __name__ == '__main__':\n import sys¡",
os.path.join(
"compilation_failure", "BUILD"
): "python_library()\npex_binary(name='bin', entry_point='main.py')",
}


class TestPantsDaemonIntegration(PantsDaemonIntegrationTestBase):
hermetic = False

Expand All @@ -76,11 +85,12 @@ def test_pantsd_broken_pipe(self):
def test_pantsd_pantsd_runner_doesnt_die_after_failed_run(self):
with self.pantsd_test_context() as (workdir, pantsd_config, checker):
# Run target that throws an exception in pants.
self.run_pants_with_workdir(
["lint", "testprojects/src/python/unicode/compilation_failure/main:lib"],
workdir=workdir,
config=pantsd_config,
).assert_failure()
with setup_tmpdir(compilation_failure_dir_layout) as tmpdir:
self.run_pants_with_workdir(
["lint", os.path.join(tmpdir, "compilation_failure", "main.py")],
workdir=workdir,
config=pantsd_config,
).assert_failure()
checker.assert_started()

# Assert pantsd is in a good functional state.
Expand Down

0 comments on commit e454042

Please sign in to comment.