Skip to content

Commit

Permalink
Address latest review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrechevalier83 committed Oct 2, 2019
1 parent f8ef9de commit ddca228
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/python/pants/backend/python/rules/python_fmt.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

import os
import re
from dataclasses import dataclass
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions src/python/pants/bin/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ python_binary(
'//:build_tools',
'//:pants_ini',
'//:3rdparty_directory',
'//:pyproject',
'build-support/checkstyle',
'build-support/eslint',
'build-support/ivy',
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/rules/core/fmt.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

import os
from dataclasses import dataclass
from pathlib import Path

Expand Down
2 changes: 0 additions & 2 deletions tests/python/pants_test/backend/python/rules/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,9 @@ python_tests(
source='test_python_fmt_integration.py',
dependencies=[
'tests/python/pants_test:int-test',
'//:pyproject',
'testprojects/src/python:unicode_directory',
'examples/src/python/example:hello_directory',
],
tags={'integration'},
timeout = 90,
)

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from os.path import relpath
from pathlib import Path

from pants.util.contextutil import temporary_file, temporary_file_path
from pants_test.pants_run_integration_test import PantsRunIntegrationTest, ensure_daemon
Expand Down Expand Up @@ -70,8 +71,7 @@ def test_black_should_format_python_code(self):
'examples/src/python/example/hello/greet:greet'
]
pants_run = self.run_pants(command=command)
code = open(file_name)
formatted = code.read();
formatted = Path(file_name).read_text();
self.assertEqual("x = 42\n", formatted)
self.assert_success(pants_run)
self.assertIn("1 file reformatted", pants_run.stderr_data)
Expand Down
3 changes: 2 additions & 1 deletion tests/python/pants_test/pants_run_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,8 @@ def run_pants_with_workdir_without_waiting(self, command, workdir, config=None,
ini.write(fp)
args.append('--pants-config-files=' + ini_file_name)

Path('pyproject.toml').touch()
if not Path(get_buildroot()).samefile(Path(".")):
shutil.copy(str(Path(get_buildroot(), "pyproject.toml")), str(Path(".")))

pants_script = [sys.executable, '-m', 'pants']

Expand Down
2 changes: 0 additions & 2 deletions tests/python/pants_test/rules/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ python_tests(
source='test_fmt_integration.py',
dependencies=[
'tests/python/pants_test:int-test',
'//:pyproject',
'testprojects/tests/java/org/pantsbuild/testproject:dummies_directory',
],
tags={'integration'},
timeout = 90,
)

2 changes: 1 addition & 1 deletion tests/python/pants_test/rules/test_fmt_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


class FmtIntegrationTest(PantsRunIntegrationTest):
def test_black_no_python_sources_should_noop(self):
def test_fmt_for_unsupported_target_should_noop(self):
command = [
'fmt-v2',
'testprojects/tests/java/org/pantsbuild/testproject/dummies/::'
Expand Down

0 comments on commit ddca228

Please sign in to comment.