• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Qiskit / ecosystem / 30713661660

01 Aug 2026 06:56PM UTC coverage: 70.42% (+14.6%) from 55.824%
30713661660

push

github

1ucian0
refactor

1926 of 2735 relevant lines covered (70.42%)

0.7 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.33
/tests/github/test_templates.py
1
# This code is part of Qiskit.
2
#
3
# (C) Copyright IBM 2026.
4
#
5
# This code is licensed under the Apache License, Version 2.0. You may
6
# obtain a copy of this license in the LICENSE.txt file in the root directory
7
# of this source tree or at https://www.apache.org/licenses/LICENSE-2.0.
8
#
9
# Any modifications or derivative works of this code must retain this
10
# copyright notice, and modified files need to carry a notice indicating
11
# that they have been altered from the originals.
12

13

14
"""Tests for GitHub Templates."""
1✔
15

16
import os
1✔
17
from unittest import TestCase
1✔
18
from ruamel.yaml import YAML
1✔
19

20
from ecosystem.classifications import ClassificationsToml
1✔
21

22

23
class Test01submission(TestCase):
1✔
24
    """Test class for .github/ISSUE_TEMPLATE/01_submission.yml"""
25

26
    def setUp(self) -> None:
1✔
27
        root_dir = f"{os.path.dirname(os.path.abspath(__file__))}/../../"
1✔
28
        self.classifications_toml = ClassificationsToml(
1✔
29
            resources_dir=f"{root_dir}/resources"
30
        )
31

32
        def show_in_submission_template(x):
1✔
33
            return (
1✔
34
                x["show_in_submission_template"]
35
                if "show_in_submission_template" in x
36
                else True
37
            )
38

39
        self.classifications_toml.set_filter(show_in_submission_template)
1✔
40
        yaml = YAML()
1✔
41
        with open(
1✔
42
            f"{root_dir}/.github/ISSUE_TEMPLATE/01_submission.yml", "r"
43
        ) as issue_template_file:
44
            self.issue_template = yaml.load(issue_template_file)
1✔
45

46
    def test_categories(self):
1✔
47
        """categories_names in the template should exist in classifications.toml"""
48
        for section in self.issue_template["body"]:
1✔
49
            if "id" in section and section["id"] == "category":
1✔
50
                self.assertIn("attributes", section)
1✔
51
                self.assertIn("options", section["attributes"])
1✔
52
                self.assertEqual(
1✔
53
                    list(section["attributes"]["options"]),
54
                    ["Select one..."] + self.classifications_toml.category_names,
55
                )
56

57
    def test_labels(self):
1✔
58
        """labels in the issue template should exist in classsifications.toml"""
59
        for section in self.issue_template["body"]:
1✔
60
            if "id" in section and section["id"] == "labels":
1✔
61
                self.assertIn("attributes", section)
1✔
62
                self.assertIn("options", section["attributes"])
1✔
63
                self.assertEqual(
1✔
64
                    list(section["attributes"]["options"]),
65
                    self.classifications_toml.labels_names,
66
                )
67

68
    def test_interfaces(self):
1✔
69
        """interfaces in the template should exist in classifications.toml"""
70
        for section in self.issue_template["body"]:
1✔
71
            if "id" in section and section["id"] == "interfaces":
1✔
72
                self.assertIn("attributes", section)
1✔
73
                self.assertIn("options", section["attributes"])
1✔
74
                self.assertEqual(
1✔
75
                    section["attributes"]["options"],
76
                    self.classifications_toml.interfaces_names,
77
                )
78

79
    def test_maturity(self):
1✔
80
        """maturity classification in the template should exist in classifications.toml"""
81
        for section in self.issue_template["body"]:
1✔
82
            if "id" in section and section["id"] == "maturity":
1✔
83
                self.assertIn("attributes", section)
1✔
84
                self.assertIn("options", section["attributes"])
1✔
85
                self.assertEqual(
1✔
86
                    list(section["attributes"]["options"]),
87
                    self.classifications_toml.maturity_names,
88
                )
89

90
    def test_pattern_step(self):
1✔
91
        """Qiskit pattern step in the template should exist in classifications.toml"""
92
        for section in self.issue_template["body"]:
1✔
93
            if "id" in section and section["id"] == "pattern_step":
1✔
94
                self.assertIn("attributes", section)
×
95
                self.assertIn("options", section["attributes"])
×
96
                self.assertEqual(
×
97
                    section["attributes"]["options"],
98
                    self.classifications_toml.interface_names,
99
                )
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc