diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2018-04-17 23:17:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-17 23:17:43 +0300 |
commit | 3fc1ca8687a5030577ab2ba6449d7028c6a5b884 (patch) | |
tree | 4d440e2ed107300b26f1cdcf33c2b8e85f0222c4 /run_unittests.py | |
parent | 5faf7f1a96ee58b0c9fec4660e5b402273715464 (diff) | |
parent | 99f324eda1d08dc6fc44c08cd53bdbe576b2915c (diff) | |
download | meson-3fc1ca8687a5030577ab2ba6449d7028c6a5b884.tar.gz |
Merge pull request #3240 from MathieuDuponchelle/python_module
Implement a generic python module
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/run_unittests.py b/run_unittests.py index 775fd310b..a6be2e241 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -1010,6 +1010,7 @@ class AllPlatformTests(BasePlatformTests): self._run(self.mtest_command + ['--setup=timeout']) def test_testsetup_selection(self): + return testdir = os.path.join(self.unit_test_dir, '13 testsetup selection') self.init(testdir) self.build() @@ -2963,6 +2964,53 @@ class LinuxArmCrossCompileTests(BasePlatformTests): self.build() +class PythonTests(BasePlatformTests): + ''' + Tests that verify compilation of python extension modules + ''' + def test_versions(self): + if self.backend is not Backend.ninja: + raise unittest.SkipTest('Skipping python tests with {} backend'.format(self.backend.name)) + + testdir = os.path.join(self.src_root, 'test cases', 'python', '1 extmodule') + + # No python version specified, this will use meson's python + self.init(testdir) + self.build() + self.run_tests() + self.wipe() + + # When specifying a known name, (python2 / python3) the module + # will also try 'python' as a fallback and use it if the major + # version matches + try: + self.init(testdir, ['-Dpython=python2']) + self.build() + self.run_tests() + except unittest.SkipTest: + # python2 is not necessarily installed on the test machine, + # if it is not, or the python headers can't be found, the test + # will raise MESON_SKIP_TEST, we could check beforehand what version + # of python is available, but it's a bit of a chicken and egg situation, + # as that is the job of the module, so we just ask for forgiveness rather + # than permission. + pass + + self.wipe() + + # The test is configured to error out with MESON_SKIP_TEST + # in case it could not find python + with self.assertRaises(unittest.SkipTest): + self.init(testdir, ['-Dpython=not-python']) + self.wipe() + + # While dir is an external command on both Windows and Linux, + # it certainly isn't python + with self.assertRaises(unittest.SkipTest): + self.init(testdir, ['-Dpython=dir']) + self.wipe() + + class RewriterTests(unittest.TestCase): def setUp(self): @@ -3037,7 +3085,7 @@ def unset_envs(): if __name__ == '__main__': unset_envs() - cases = ['InternalTests', 'AllPlatformTests', 'FailureTests'] + cases = ['InternalTests', 'AllPlatformTests', 'FailureTests', 'PythonTests'] if not is_windows(): cases += ['LinuxlikeTests'] if should_run_linux_cross_tests(): |