$99 GRAYBYTE WORDPRESS FILE MANAGER $68

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/cloudlinux/venv/lib/python3.11/site-packages/tap/

HOME
Current File : /opt/cloudlinux/venv/lib/python3.11/site-packages/tap//loader.py
import os
import unittest

from tap.adapter import Adapter
from tap.parser import Parser
from tap.rules import Rules


class Loader:
    """Load TAP lines into unittest-able objects."""

    ignored_lines = set(["diagnostic", "unknown"])

    def __init__(self):
        self._parser = Parser()

    def load(self, files):
        """Load any files found into a suite.

        Any directories are walked and their files are added as TAP files.

        :returns: A ``unittest.TestSuite`` instance
        """
        suite = unittest.TestSuite()
        for filepath in files:
            if os.path.isdir(filepath):
                self._find_tests_in_directory(filepath, suite)
            else:
                suite.addTest(self.load_suite_from_file(filepath))
        return suite

    def load_suite_from_file(self, filename):
        """Load a test suite with test lines from the provided TAP file.

        :returns: A ``unittest.TestSuite`` instance
        """
        suite = unittest.TestSuite()
        rules = Rules(filename, suite)

        if not os.path.exists(filename):
            rules.handle_file_does_not_exist()
            return suite

        line_generator = self._parser.parse_file(filename)
        return self._load_lines(filename, line_generator, suite, rules)

    def load_suite_from_stdin(self):
        """Load a test suite with test lines from the TAP stream on STDIN.

        :returns: A ``unittest.TestSuite`` instance
        """
        suite = unittest.TestSuite()
        rules = Rules("stream", suite)
        line_generator = self._parser.parse_stdin()
        return self._load_lines("stream", line_generator, suite, rules)

    def _find_tests_in_directory(self, directory, suite):
        """Find test files in the directory and add them to the suite."""
        for dirpath, _dirnames, filenames in os.walk(directory):
            for filename in filenames:
                filepath = os.path.join(dirpath, filename)
                suite.addTest(self.load_suite_from_file(filepath))

    def _load_lines(self, filename, line_generator, suite, rules):
        """Load a suite with lines produced by the line generator."""
        line_counter = 0
        for line in line_generator:
            line_counter += 1

            if line.category in self.ignored_lines:
                continue

            if line.category == "test":
                suite.addTest(Adapter(filename, line))
                rules.saw_test()
            elif line.category == "plan":
                if line.skip:
                    rules.handle_skipping_plan(line)
                    return suite
                rules.saw_plan(line, line_counter)
            elif line.category == "bail":
                rules.handle_bail(line)
                return suite
            elif line.category == "version":
                rules.saw_version_at(line_counter)

        rules.check(line_counter)
        return suite

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
17 Dec 2025 3.08 AM
root / root
0755
__pycache__
--
14 Aug 2025 9.24 PM
root / root
0755
tests
--
14 Aug 2025 9.30 PM
root / root
0755
__init__.py
0.083 KB
17 Apr 2025 8.10 PM
root / root
0644
__main__.py
0.047 KB
17 Apr 2025 8.10 PM
root / root
0644
adapter.py
1.474 KB
17 Apr 2025 8.10 PM
root / root
0644
directive.py
1.749 KB
17 Apr 2025 8.10 PM
root / root
0644
formatter.py
0.744 KB
17 Apr 2025 8.10 PM
root / root
0644
line.py
4.563 KB
17 Apr 2025 8.10 PM
root / root
0644
loader.py
2.874 KB
17 Apr 2025 8.10 PM
root / root
0644
main.py
2.074 KB
17 Apr 2025 8.10 PM
root / root
0644
parser.py
6.628 KB
17 Apr 2025 8.10 PM
root / root
0644
rules.py
3.299 KB
17 Apr 2025 8.10 PM
root / root
0644
runner.py
4.947 KB
17 Apr 2025 8.10 PM
root / root
0644
tracker.py
7.398 KB
17 Apr 2025 8.10 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF