| 12345678910111213141516171819202122 |
- import unittest
- from scripts.offline_env_requirements import filter_export
- class OfflineEnvironmentRequirementsTests(unittest.TestCase):
- def test_selects_arm_cpu_and_excludes_windows_cuda(self):
- exported = '''
- torch==2.14.0+cpu ; platform_machine == "aarch64" and sys_platform == "linux"
- torch==2.14.0+cu130 ; sys_platform == "win32"
- cuda-toolkit==13.0.3 ; platform_machine != "aarch64" and sys_platform == "linux"
- numpy==2.5.3
- '''
- self.assertEqual(filter_export(exported), 'torch==2.14.0+cpu\nnumpy==2.5.3\n')
- def test_rejects_missing_cpu_torch(self):
- with self.assertRaisesRegex(RuntimeError, 'target_cpu_torch_missing'):
- filter_export('numpy==2.5.3')
- if __name__ == '__main__':
- unittest.main()
|