diff options
-rw-r--r-- | meta/lib/oeqa/selftest/cases/recipetool.py | 65 |
1 files changed, 20 insertions, 45 deletions
diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py index 39114c6762..780e25b6c8 100644 --- a/meta/lib/oeqa/selftest/cases/recipetool.py +++ b/meta/lib/oeqa/selftest/cases/recipetool.py | |||
@@ -28,6 +28,16 @@ def tearDownModule(): | |||
28 | runCmd('rm -rf %s' % templayerdir) | 28 | runCmd('rm -rf %s' % templayerdir) |
29 | 29 | ||
30 | 30 | ||
31 | def needTomllib(test): | ||
32 | # This test require python 3.11 or above for the tomllib module or tomli module to be installed | ||
33 | try: | ||
34 | import tomllib | ||
35 | except ImportError: | ||
36 | try: | ||
37 | import tomli | ||
38 | except ImportError: | ||
39 | test.skipTest('Test requires python 3.11 or above for tomllib module or tomli module') | ||
40 | |||
31 | class RecipetoolBase(devtool.DevtoolTestCase): | 41 | class RecipetoolBase(devtool.DevtoolTestCase): |
32 | 42 | ||
33 | def setUpLocal(self): | 43 | def setUpLocal(self): |
@@ -554,15 +564,8 @@ class RecipetoolCreateTests(RecipetoolBase): | |||
554 | self._test_recipe_contents(recipefile, checkvars, inherits) | 564 | self._test_recipe_contents(recipefile, checkvars, inherits) |
555 | 565 | ||
556 | def test_recipetool_create_python3_pep517_setuptools_build_meta(self): | 566 | def test_recipetool_create_python3_pep517_setuptools_build_meta(self): |
557 | # This test require python 3.11 or above for the tomllib module | 567 | # This test require python 3.11 or above for the tomllib module or tomli module to be installed |
558 | # or tomli module to be installed | 568 | needTomllib(self) |
559 | try: | ||
560 | import tomllib | ||
561 | except ImportError: | ||
562 | try: | ||
563 | import tomli | ||
564 | except ImportError: | ||
565 | self.skipTest('Test requires python 3.11 or above for tomllib module or tomli module') | ||
566 | 569 | ||
567 | # Test creating python3 package from tarball (using setuptools.build_meta class) | 570 | # Test creating python3 package from tarball (using setuptools.build_meta class) |
568 | temprecipe = os.path.join(self.tempdir, 'recipe') | 571 | temprecipe = os.path.join(self.tempdir, 'recipe') |
@@ -583,15 +586,8 @@ class RecipetoolCreateTests(RecipetoolBase): | |||
583 | self._test_recipe_contents(recipefile, checkvars, inherits) | 586 | self._test_recipe_contents(recipefile, checkvars, inherits) |
584 | 587 | ||
585 | def test_recipetool_create_python3_pep517_poetry_core_masonry_api(self): | 588 | def test_recipetool_create_python3_pep517_poetry_core_masonry_api(self): |
586 | # This test require python 3.11 or above for the tomllib module | 589 | # This test require python 3.11 or above for the tomllib module or tomli module to be installed |
587 | # or tomli module to be installed | 590 | needTomllib(self) |
588 | try: | ||
589 | import tomllib | ||
590 | except ImportError: | ||
591 | try: | ||
592 | import tomli | ||
593 | except ImportError: | ||
594 | self.skipTest('Test requires python 3.11 or above for tomllib module or tomli module') | ||
595 | 591 | ||
596 | # Test creating python3 package from tarball (using poetry.core.masonry.api class) | 592 | # Test creating python3 package from tarball (using poetry.core.masonry.api class) |
597 | temprecipe = os.path.join(self.tempdir, 'recipe') | 593 | temprecipe = os.path.join(self.tempdir, 'recipe') |
@@ -612,15 +608,8 @@ class RecipetoolCreateTests(RecipetoolBase): | |||
612 | self._test_recipe_contents(recipefile, checkvars, inherits) | 608 | self._test_recipe_contents(recipefile, checkvars, inherits) |
613 | 609 | ||
614 | def test_recipetool_create_python3_pep517_flit_core_buildapi(self): | 610 | def test_recipetool_create_python3_pep517_flit_core_buildapi(self): |
615 | # This test require python 3.11 or above for the tomllib module | 611 | # This test require python 3.11 or above for the tomllib module or tomli module to be installed |
616 | # or tomli module to be installed | 612 | needTomllib(self) |
617 | try: | ||
618 | import tomllib | ||
619 | except ImportError: | ||
620 | try: | ||
621 | import tomli | ||
622 | except ImportError: | ||
623 | self.skipTest('Test requires python 3.11 or above for tomllib module or tomli module') | ||
624 | 613 | ||
625 | # Test creating python3 package from tarball (using flit_core.buildapi class) | 614 | # Test creating python3 package from tarball (using flit_core.buildapi class) |
626 | temprecipe = os.path.join(self.tempdir, 'recipe') | 615 | temprecipe = os.path.join(self.tempdir, 'recipe') |
@@ -641,15 +630,8 @@ class RecipetoolCreateTests(RecipetoolBase): | |||
641 | self._test_recipe_contents(recipefile, checkvars, inherits) | 630 | self._test_recipe_contents(recipefile, checkvars, inherits) |
642 | 631 | ||
643 | def test_recipetool_create_python3_pep517_hatchling(self): | 632 | def test_recipetool_create_python3_pep517_hatchling(self): |
644 | # This test require python 3.11 or above for the tomllib module | 633 | # This test require python 3.11 or above for the tomllib module or tomli module to be installed |
645 | # or tomli module to be installed | 634 | needTomllib(self) |
646 | try: | ||
647 | import tomllib | ||
648 | except ImportError: | ||
649 | try: | ||
650 | import tomli | ||
651 | except ImportError: | ||
652 | self.skipTest('Test requires python 3.11 or above for tomllib module or tomli module') | ||
653 | 635 | ||
654 | # Test creating python3 package from tarball (using hatchling class) | 636 | # Test creating python3 package from tarball (using hatchling class) |
655 | temprecipe = os.path.join(self.tempdir, 'recipe') | 637 | temprecipe = os.path.join(self.tempdir, 'recipe') |
@@ -671,15 +653,8 @@ class RecipetoolCreateTests(RecipetoolBase): | |||
671 | self._test_recipe_contents(recipefile, checkvars, inherits) | 653 | self._test_recipe_contents(recipefile, checkvars, inherits) |
672 | 654 | ||
673 | def test_recipetool_create_python3_pep517_maturin(self): | 655 | def test_recipetool_create_python3_pep517_maturin(self): |
674 | # This test require python 3.11 or above for the tomllib module | 656 | # This test require python 3.11 or above for the tomllib module or tomli module to be installed |
675 | # or tomli module to be installed | 657 | needTomllib(self) |
676 | try: | ||
677 | import tomllib | ||
678 | except ImportError: | ||
679 | try: | ||
680 | import tomli | ||
681 | except ImportError: | ||
682 | self.skipTest('Test requires python 3.11 or above for tomllib module or tomli module') | ||
683 | 658 | ||
684 | # Test creating python3 package from tarball (using maturin class) | 659 | # Test creating python3 package from tarball (using maturin class) |
685 | temprecipe = os.path.join(self.tempdir, 'recipe') | 660 | temprecipe = os.path.join(self.tempdir, 'recipe') |