aboutsummaryrefslogtreecommitdiff
path: root/tests/pip_repository_entry_points/BUILD.bazel
blob: 81c01c316c10bc4515960351f372a86b96cc08a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
load("@pip_installed//:requirements.bzl", installed_entry_point = "entry_point")
load("@pip_parsed//:requirements.bzl", parsed_entry_point = "entry_point")
load("@rules_python//python:defs.bzl", "py_test")
load("@rules_python//python:pip.bzl", "compile_pip_requirements")

# This rule adds a convenient way to update the requirements file.
compile_pip_requirements(
    name = "requirements",
    extra_args = ["--allow-unsafe"],
    requirements_windows = ":requirements_windows.txt",
)

pip_parsed_sphinx = parsed_entry_point(
    pkg = "sphinx",
    script = "sphinx-build",
)

pip_parsed_yamllint = parsed_entry_point("yamllint")

py_test(
    name = "pip_parse_entry_points_test",
    srcs = ["pip_repository_entry_points_test.py"],
    data = [
        pip_parsed_sphinx,
        pip_parsed_yamllint,
    ],
    env = {
        "SPHINX_BUILD_ENTRY_POINT": "$(rootpath {})".format(pip_parsed_sphinx),
        "YAMLLINT_ENTRY_POINT": "$(rootpath {})".format(pip_parsed_yamllint),
    },
    main = "pip_repository_entry_points_test.py",
    deps = ["@rules_python//python/runfiles"],
)

pip_installed_sphinx = installed_entry_point(
    pkg = "sphinx",
    script = "sphinx-build",
)

pip_installed_yamllint = installed_entry_point("yamllint")

py_test(
    name = "pip_install_annotations_test",
    srcs = ["pip_repository_entry_points_test.py"],
    data = [
        pip_installed_sphinx,
        pip_installed_yamllint,
    ],
    env = {
        "SPHINX_BUILD_ENTRY_POINT": "$(rootpath {})".format(pip_installed_sphinx),
        "YAMLLINT_ENTRY_POINT": "$(rootpath {})".format(pip_installed_yamllint),
    },
    main = "pip_repository_entry_points_test.py",
    deps = ["@rules_python//python/runfiles"],
)