Skip to content
Merged
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
3 changes: 2 additions & 1 deletion .plzconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Please]
Version = >=17.12.2
Version = >=17.19.1

[Build]
hashcheckers = sha256
Expand All @@ -18,6 +18,7 @@ Target = //plugins:shell

[Plugin "e2e"]
Target = //plugins:e2e
DefaultPlugin = //test:python-rules

[PluginDefinition]
name = python
Expand Down
9 changes: 9 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,12 @@ remote_file(
url = f"https://get.please.build/{CONFIG.OS}_{CONFIG.ARCH}/{v}/please_{v}",
visibility = ["PUBLIC"],
)

export_file(
name = "plzconfig",
src = ".plzconfig",
test_only = True,
visibility = [
"//test:python-rules",
],
)
2 changes: 1 addition & 1 deletion plugins/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ plugin_repo(
plugin_repo(
name = "e2e",
plugin = "plugin-integration-testing",
revision = "v1.0.3",
revision = "v1.1.0",
)
39 changes: 27 additions & 12 deletions test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ package(
},
)

e2e_test_plugin(
name = "python-rules",
srcs = [
"//build_defs:archs",
"//build_defs:python",
"//build_defs:version",
"//tools:please_pex",
"//:plzconfig",
],
visibility = [
"//test/...",
],
)

python_binary(
name = "strip_source",
main = "strip_source.py",
Expand Down Expand Up @@ -132,18 +146,19 @@ python_test(
deps = ["//third_party/python:cx_oracle"],
)

plz_e2e_test(
name = "correct_labels_on_pip_libary_non_zip_safe",
cmd = "plz query print -f labels //third_party/python:pyyaml",
expected_output = "expected_labels_on_pyyaml.txt",
deps = ["//third_party/python:pyyaml"],
)

plz_e2e_test(
name = "correct_labels_on_pip_libary_zip_safe",
cmd = "plz query print -f labels //third_party/python:grpcio",
expected_output = "expected_labels_on_grpcio.txt",
deps = ["//third_party/python:grpcio"],
plugin_e2e_test(
name = "pip_libary_zip_safe_label_test",
repo = "zip_safe_label_repo",
test_cmd = [
"plz query print -f labels //third_party/python:safe > safe",
"plz query print -f labels //third_party/python:safe_implicit > safe_implicit",
"plz query print -f labels //third_party/python:unsafe > unsafe",
],
expected_output = {
"safe": "py\npip:safe==1.0.0",
"safe_implicit": "py\npip:safe_implicit==1.0.0",
"unsafe": "py\npip:unsafe==1.0.0\npy:zip-unsafe",
},
)

# Test that python_wheel targets can have name_scheme as a list or a string
Expand Down
2 changes: 0 additions & 2 deletions test/expected_labels_on_grpcio.txt

This file was deleted.

3 changes: 0 additions & 3 deletions test/expected_labels_on_pyyaml.txt

This file was deleted.

2 changes: 2 additions & 0 deletions test/zip_safe_label_repo/.plzconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Plugin "python"]
Target = //plugins:python
4 changes: 4 additions & 0 deletions test/zip_safe_label_repo/plugins/BUILD_FILE
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
plugin_repo(
name = "python",
revision = "e2e",
)
33 changes: 33 additions & 0 deletions test/zip_safe_label_repo/third_party/python/BUILD_FILE
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
subinclude("///python//build_defs:python")

package(
# The pip_library targets below aren't real Python modules, and don't need to be downloaded in
# order for this test to run - make sure we don't accidentally look for them on PyPI.
python = {
"default_pip_repo": "https://nonexistent.example",
"use_pypi": False,
},
)

# This target is explicitly zip-safe:
pip_library(
name = "safe",
licences = ["MIT"],
version = "1.0.0",
zip_safe = True,
)

# This target is implicitly zip-safe, because it specifies no value for zip_safe:
pip_library(
name = "safe_implicit",
licences = ["MIT"],
version = "1.0.0",
)

# This target is explicitly zip-unsafe:
pip_library(
name = "unsafe",
licences = ["MIT"],
version = "1.0.0",
zip_safe = False,
)