Skip to content
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

Allow Sources subclasses to specify the # of expected files #9466

Merged

Conversation

Eric-Arellano
Copy link
Contributor

@Eric-Arellano Eric-Arellano commented Apr 4, 2020

Twice now, we've had Sources fields that require a specific number of files. So, this PR formalizes a mechanism to do this.

Error message #1:

ERROR: The 'sources' field in target build-support/bin:check_banned_imports must have 3 files, but it had 1 file.

Error message #2:

ERROR: The 'sources' field in target build-support/bin:check_banned_imports must have 2 or 3 files, but it had 1 file.

Error message #3:

ERROR: The 'sources' field in target build-support/bin:check_banned_imports must have a number of files in the range range(20, 20000, 10), but it had 1 file.

[ci skip-rust-tests] # No Rust changes made.
[ci skip-jvm-tests] # No JVM changes made.

# Delete this line to force CI to run Clippy and the Rust tests.
[ci skip-rust-tests]  # No Rust changes made.

# Delete this line to force CI to run the JVM tests.
[ci skip-jvm-tests]  # No JVM changes made.
@@ -6,8 +6,6 @@

from pants.backend.python.subsystems.pytest import PyTest
from pants.build_graph.address import Address
from pants.engine.fs import Snapshot
Copy link
Contributor Author

@Eric-Arellano Eric-Arellano Apr 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most changes in this file only move around code. The only real change is to PythonBinarySources near the top of the file.

Comment on lines +59 to +60
class PythonBinarySources(PythonSources):
expected_num_files = range(0, 2)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only real change to this file.

# Delete this line to force CI to run Clippy and the Rust tests.
[ci skip-rust-tests]  # No Rust changes made.

# Delete this line to force CI to run the JVM tests.
[ci skip-jvm-tests]  # No JVM changes made.
# Delete this line to force CI to run Clippy and the Rust tests.
[ci skip-rust-tests]  # No Rust changes made.

# Delete this line to force CI to run the JVM tests.
[ci skip-jvm-tests]  # No JVM changes made.
@Eric-Arellano Eric-Arellano merged commit 3e0b781 into pantsbuild:master Apr 5, 2020
@Eric-Arellano Eric-Arellano deleted the sources-num-files-range branch April 5, 2020 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants