diff --git a/test/BUILD b/test/BUILD index dfdc610..d12cad3 100644 --- a/test/BUILD +++ b/test/BUILD @@ -172,6 +172,14 @@ python_test( ], ) +python_test( + name = "resources_test", + srcs = ["resources_test.py"], + deps = [ + "//third_party/python:pygments", + ], +) + python_test( name = "interpreter_not_included_test", srcs = ["interpreter_not_included_test.py"], diff --git a/test/resources_test.py b/test/resources_test.py new file mode 100644 index 0000000..ec75e50 --- /dev/null +++ b/test/resources_test.py @@ -0,0 +1,12 @@ +import importlib.resources +import unittest + + +class ResourcesTest(unittest.TestCase): + """Tests that PexDistribution is able to provide access to files that are part of a distribution + via the importlib.resources API. + """ + + def test_read_resource_text_file(self): + init = importlib.resources.files("pygments") / "__init__.py" + self.assertIn("__version__ = '2.19.2'", init.read_text())