Philipp Schrader | 9e1b9bd | 2021-12-28 00:15:12 -0800 | [diff] [blame] | 1 | import sys |
| 2 | import unittest |
| 3 | |
| 4 | |
| 5 | class TestPipImports(unittest.TestCase): |
| 6 | |
| 7 | def test_version(self): |
| 8 | """Validates that we are using the version specified in rules_python.""" |
Philipp Schrader | 9ebb706 | 2022-12-07 20:17:15 -0800 | [diff] [blame^] | 9 | self.assertEqual(sys.version_info[0:3], (3, 9, 15)) |
Philipp Schrader | 9e1b9bd | 2021-12-28 00:15:12 -0800 | [diff] [blame] | 10 | |
| 11 | def test_imports(self): |
| 12 | """Validates that we can import pip packages from pypi.org.""" |
| 13 | import numpy |
| 14 | import scipy |
| 15 | import matplotlib |
| 16 | |
| 17 | # Make sure we're sourcing numpy from the expected source. We could |
| 18 | # pick any of the three we imported above. |
| 19 | self.assertTrue( |
| 20 | numpy.__file__.endswith( |
| 21 | "/upstream_python_test.runfiles/pip_deps_numpy/site-packages/numpy/__init__.py" |
| 22 | ), numpy.__file__) |
| 23 | |
| 24 | |
| 25 | if __name__ == "__main__": |
| 26 | unittest.main() |