forked from bazel-contrib/rules_python
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathimportlib_metadata_test.py
More file actions
24 lines (17 loc) · 888 Bytes
/
importlib_metadata_test.py
File metadata and controls
24 lines (17 loc) · 888 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import importlib.metadata
import unittest
class ImportlibMetadataTest(unittest.TestCase):
def test_importlib_metadata_files(self):
files = importlib.metadata.files("whl-with-data1")
self.assertIsNotNone(files, "importlib.metadata.files returned None")
self.assertGreater(
len(files), 0, "importlib.metadata.files returned empty list"
)
# Verify it contains some expected files.
# The RECORD file lists paths relative to the installation root (site-packages).
# whl_with_data1-1.0.data/purelib/data_overlap.py should be installed as data_overlap.py
# whl_with_data1-1.0.data/platlib/whl_with_data1/platlib_file.txt should be whl_with_data1/platlib_file.txt
file_names = [f.name for f in files]
self.assertIn("data_overlap.py", file_names)
if __name__ == "__main__":
unittest.main()