|
| 1 | +"""unit tests for globstar poetry_venv repository rule""" |
| 2 | + |
| 3 | +load("@bazel_skylib//lib:partial.bzl", "partial") |
| 4 | +load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts", "unittest") |
| 5 | +load("//python:private/poetry_venv.bzl", "parse_lock_file") |
| 6 | + |
| 7 | +def _parse_lock_file_test_impl(ctx): |
| 8 | + env = unittest.begin(ctx) |
| 9 | + |
| 10 | + lock = """# This file is automatically @generated by Poetry 1.4.1 and should not be changed by hand. |
| 11 | +
|
| 12 | +[[package]] |
| 13 | +name = "aenum" |
| 14 | +version = "3.1.12" |
| 15 | +description = "Advanced Enumerations (compatible with Python's stdlib Enum), NamedTuples, and NamedConstants" |
| 16 | +category = "main" |
| 17 | +optional = false |
| 18 | +python-versions = "*" |
| 19 | +files = [ |
| 20 | + {file = "aenum-3.1.12-py2-none-any.whl", hash = "sha256:8d79c9e3ec997220e355b96b322e672fb56a53e61744138ed838407e3a07b610"}, |
| 21 | + {file = "aenum-3.1.12-py3-none-any.whl", hash = "sha256:2d544ef7323c088d68abf9a84b9f3f6db0d516fec685e15678b5f84fdb7b8ba0"}, |
| 22 | + {file = "aenum-3.1.12.tar.gz", hash = "sha256:3e531c91860a81f885f7e6e97d219ae9772cb899580084788935dad7d9742ef0"}, |
| 23 | +] |
| 24 | +
|
| 25 | +[[package]] |
| 26 | +name = "moto" |
| 27 | +version = "4.1.6" |
| 28 | +description = "" |
| 29 | +category = "main" |
| 30 | +optional = false |
| 31 | +python-versions = ">=3.7" |
| 32 | +files = [ |
| 33 | + {file = "moto-4.1.6-py2.py3-none-any.whl", hash = "sha256:cfe398a1f6e317d061c47c3d2dd8c6893f3eb49154984a7cbb8bcd4ba517d67d"}, |
| 34 | + {file = "moto-4.1.6.tar.gz", hash = "sha256:fdcc2731212ca050a28b2bc83e87628294bcbd55cb4f4c4692f972023fb1e7e6"}, |
| 35 | +] |
| 36 | +
|
| 37 | +[package.dependencies] |
| 38 | +aws-xray-sdk = {version = ">=0.93,<0.96 || >0.96", optional = true, markers = "extra == \\"server\\""} |
| 39 | +boto3 = ">=1.9.201" |
| 40 | +botocore = ">=1.12.201" |
| 41 | +
|
| 42 | +
|
| 43 | +[[package]] |
| 44 | +name = "click" |
| 45 | +version = "8.1.3" |
| 46 | +description = "Composable command line interface toolkit" |
| 47 | +category = "main" |
| 48 | +optional = false |
| 49 | +python-versions = ">=3.7" |
| 50 | +files = [ |
| 51 | + {file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"}, |
| 52 | + {file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"}, |
| 53 | +] |
| 54 | +
|
| 55 | +[package.dependencies] |
| 56 | +colorama = {version = "*", markers = "platform_system == \\"Windows\\""} |
| 57 | +packaging = ">=14.0" |
| 58 | +pywin32 = {version = ">=304", markers = "sys_platform == \\"win32\\""} |
| 59 | +
|
| 60 | +[[package]] |
| 61 | +name = "tqdm" |
| 62 | +version = "4.65.0" |
| 63 | +description = "Fast, Extensible Progress Meter" |
| 64 | +category = "main" |
| 65 | +optional = false |
| 66 | +python-versions = ">=3.7" |
| 67 | +files = [ |
| 68 | + {file = "tqdm-4.65.0-py3-none-any.whl", hash = "sha256:c4f53a17fe37e132815abceec022631be8ffe1b9381c2e6e30aa70edc99e9671"}, |
| 69 | + {file = "tqdm-4.65.0.tar.gz", hash = "sha256:1871fb68a86b8fb3b59ca4cdd3dcccbc7e6d613eeed31f4c332531977b89beb5"}, |
| 70 | +] |
| 71 | +
|
| 72 | +[package.dependencies] |
| 73 | +colorama = {version = "*", markers = "platform_system == \\"Windows\\""} |
| 74 | +
|
| 75 | +[package.extras] |
| 76 | +dev = ["py-make (>=0.1.0)", "twine", "wheel"] |
| 77 | +notebook = ["ipywidgets (>=6)"] |
| 78 | +slack = ["slack-sdk"] |
| 79 | +telegram = ["requests"] |
| 80 | +
|
| 81 | +[[package]] |
| 82 | +name = "flask" |
| 83 | +version = "2.2.3" |
| 84 | +description = "A simple framework for building complex web applications." |
| 85 | +category = "main" |
| 86 | +optional = false |
| 87 | +python-versions = ">=3.7" |
| 88 | +files = [ |
| 89 | + {file = "Flask-2.2.3-py3-none-any.whl", hash = "sha256:c0bec9477df1cb867e5a67c9e1ab758de9cb4a3e52dd70681f59fa40a62b3f2d"}, |
| 90 | + {file = "Flask-2.2.3.tar.gz", hash = "sha256:7eb373984bf1c770023fce9db164ed0c3353cd0b53f130f4693da0ca756a2e6d"}, |
| 91 | +] |
| 92 | +
|
| 93 | +[package.dependencies] |
| 94 | +click = ">=8.0" |
| 95 | +importlib-metadata = {version = ">=3.6.0", markers = "python_version < \\"3.10\\""} |
| 96 | +itsdangerous = ">=2.0" |
| 97 | +Jinja2 = ">=3.0" |
| 98 | +Werkzeug = ">=2.2.2" |
| 99 | +colorama = {version = "*", markers = "sys_platform == \\"win32\\""} |
| 100 | +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \\"3.11\\""} |
| 101 | +tomli = {version = ">=1.0.0", markers = "python_version < \\"3.11\\""} |
| 102 | +
|
| 103 | +
|
| 104 | +""" |
| 105 | + |
| 106 | + build_content = parse_lock_file(lock) |
| 107 | + print(build_content) |
| 108 | + print("""markers ='''{"colorama ":"platform_system == \\\\\\"Windows\\\\\"""" in build_content) |
| 109 | + asserts.true(env, """package(\n name = "click",\n version = "8.1.3",\n description = "Composable command line interface toolkit",""" in build_content) |
| 110 | + asserts.true(env, """"moto-4.1.6.tar.gz": "sha256:fdcc2731212ca050a28b2bc83e87628294bcbd55cb4f4c4692f972023fb1e7e6",""" in build_content) |
| 111 | + asserts.true(env, """deps = [":click", ":importlib-metadata", ":itsdangerous", ":jinja2", ":werkzeug", ":colorama", ":exceptiongroup", ":tomli"],""" in build_content) |
| 112 | + asserts.true(env, """markers ='''{"colorama":"platform_system == \\\\\\"Windows\\\\\\"","pywin32":"sys_platform == \\\\\\"win32\\\\\\""}'''""" in build_content) |
| 113 | + return unittest.end(env) |
| 114 | + |
| 115 | +parse_lock_file_test = unittest.make(_parse_lock_file_test_impl) |
| 116 | + |
| 117 | +def poetry_venv_test_suite(): |
| 118 | + unittest.suite( |
| 119 | + "poetry_venv_test", |
| 120 | + partial.make(parse_lock_file_test), |
| 121 | + ) |
0 commit comments