(self)
| 1061 | stats=TestStats(2, 1)) |
| 1062 | |
| 1063 | def test_resources(self): |
| 1064 | # test -u command line option |
| 1065 | tests = {} |
| 1066 | for resource in ('audio', 'network'): |
| 1067 | code = textwrap.dedent(""" |
| 1068 | from test import support; support.requires(%r) |
| 1069 | import unittest |
| 1070 | class PassingTest(unittest.TestCase): |
| 1071 | def test_pass(self): |
| 1072 | pass |
| 1073 | """ % resource) |
| 1074 | |
| 1075 | tests[resource] = self.create_test(resource, code) |
| 1076 | test_names = sorted(tests.values()) |
| 1077 | |
| 1078 | # -u all: 2 resources enabled |
| 1079 | output = self.run_tests('-u', 'all', *test_names) |
| 1080 | self.check_executed_tests(output, test_names, stats=2) |
| 1081 | |
| 1082 | # -u audio: 1 resource enabled |
| 1083 | output = self.run_tests('-uaudio', *test_names) |
| 1084 | self.check_executed_tests(output, test_names, |
| 1085 | resource_denied=tests['network'], |
| 1086 | stats=1) |
| 1087 | |
| 1088 | # no option: 0 resources enabled |
| 1089 | output = self.run_tests(*test_names, exitcode=EXITCODE_NO_TESTS_RAN) |
| 1090 | self.check_executed_tests(output, test_names, |
| 1091 | resource_denied=test_names, |
| 1092 | stats=0) |
| 1093 | |
| 1094 | def test_random(self): |
| 1095 | # test -r and --randseed command line option |
nothing calls this directly
no test coverage detected