File: docs_test.py

package info (click to toggle)
pygame 2.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 42,624 kB
  • sloc: ansic: 66,926; python: 48,742; javascript: 1,153; objc: 224; sh: 121; makefile: 59; cpp: 25
file content (35 lines) | stat: -rw-r--r-- 1,065 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import os
import subprocess
import sys
import unittest


class DocsIncludedTest(unittest.TestCase):
    def test_doc_import_works(self):
        from pygame.docs.__main__ import has_local_docs, open_docs

    @unittest.skip("Docs not required for local builds")
    def test_docs_included(self):
        from pygame.docs.__main__ import has_local_docs

        self.assertTrue(has_local_docs())

    @unittest.skipIf("CI" not in os.environ, "Docs not required for local builds")
    def test_docs_command(self):
        try:
            subprocess.run(
                [sys.executable, "-m", "pygame.docs"],
                timeout=5,
                # check ensures an exception is raised when the process fails
                check=True,
                # pipe stdout/stderr so that they don't clutter main stdout
                stdout=subprocess.PIPE,
                stderr=subprocess.PIPE,
            )
        except subprocess.TimeoutExpired:
            # timeout errors are not an issue
            pass


if __name__ == "__main__":
    unittest.main()