Skip to content

Commit 630ea7b

Browse files
authored
Merge pull request #20641 from github/redsun82/fix-pytest-build-as-test-windows
Pytest: fix the `build-as-test` mode on Windows
2 parents 11a7d53 + 6d31c6a commit 630ea7b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

‎misc/bazel/pkg.bzl‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ Wrappers and helpers around `rules_pkg` to build codeql packs.
33
"""
44

55
load("@bazel_skylib//lib:paths.bzl", "paths")
6-
load("@bazel_skylib//rules:native_binary.bzl", "native_test")
76
load("@rules_pkg//pkg:install.bzl", "pkg_install")
87
load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_filegroup", "pkg_files", _strip_prefix = "strip_prefix")
98
load("@rules_pkg//pkg:pkg.bzl", "pkg_zip")
109
load("@rules_pkg//pkg:providers.bzl", "PackageFilegroupInfo", "PackageFilesInfo")
11-
load("@rules_python//python:defs.bzl", "py_binary")
10+
load("@rules_python//python:defs.bzl", "py_binary", "py_test")
1211
load("//misc/bazel:os.bzl", "OS_DETECTION_ATTRS", "os_select")
1312

1413
def _make_internal(name):
@@ -366,28 +365,29 @@ def _codeql_pack_install(name, srcs, install_dest = None, build_file_label = Non
366365
] if build_file_label else []) + (
367366
["--destdir", "\"%s\"" % install_dest] if install_dest else []
368367
)
369-
py_binary(
370-
name = name,
368+
installer_args = dict(
371369
srcs = [Label("//misc/bazel/internal:install.py")],
372370
main = Label("//misc/bazel/internal:install.py"),
373371
deps = ["@rules_python//python/runfiles"],
374372
data = data,
375373
args = args,
376374
)
375+
py_binary(
376+
name = name,
377+
**installer_args
378+
)
377379

378380
# this hack is meant to be an optimization when using install for tests, where
379381
# the install step is skipped if nothing changed. If the installation directory
380382
# is somehow messed up, `bazel run` can be used to force install
381-
native_test(
383+
py_test(
382384
name = internal("as", "test"),
383-
src = name,
384385
tags = [
385386
"manual", # avoid having this picked up by `...`, `:all` or `:*`
386387
"local", # make sure installation does not run sandboxed
387388
],
388-
data = data,
389-
args = args,
390389
size = "small",
390+
**installer_args
391391
)
392392

393393
def codeql_pack_group(name, srcs, visibility = None, skip_installer = False, prefix = "", install_dest = None, build_file_label = None, compression_level = 6):

0 commit comments

Comments
 (0)