punit 1.2.21__tar.gz → 1.2.23__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {punit-1.2.21/src/pUnit.egg-info → punit-1.2.23}/PKG-INFO +1 -1
- {punit-1.2.21 → punit-1.2.23}/pyproject.toml +1 -1
- {punit-1.2.21 → punit-1.2.23/src/pUnit.egg-info}/PKG-INFO +1 -1
- {punit-1.2.21 → punit-1.2.23}/src/punit/__init__.py +2 -2
- {punit-1.2.21 → punit-1.2.23}/src/punit/filters/Filter.py +1 -1
- {punit-1.2.21 → punit-1.2.23}/src/punit/filters/FilterManager.py +24 -7
- {punit-1.2.21 → punit-1.2.23}/.scripts/punit +0 -0
- {punit-1.2.21 → punit-1.2.23}/LICENSE +0 -0
- {punit-1.2.21 → punit-1.2.23}/README.md +0 -0
- {punit-1.2.21 → punit-1.2.23}/setup.cfg +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/pUnit.egg-info/SOURCES.txt +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/pUnit.egg-info/dependency_links.txt +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/pUnit.egg-info/requires.txt +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/pUnit.egg-info/top_level.txt +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/punit/TestResult.py +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/punit/__main__.py +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/punit/assertions/__init__.py +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/punit/assertions/collections.py +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/punit/assertions/exceptions.py +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/punit/assertions/strings.py +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/punit/cli.py +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/punit/discovery/TestModuleDiscovery.py +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/punit/discovery/__init__.py +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/punit/facts/Fact.py +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/punit/facts/FactManager.py +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/punit/facts/__init__.py +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/punit/filters/__init__.py +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/punit/py.typed +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/punit/reports/HtmlReportGenerator.py +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/punit/reports/JUnitReportGenerator.py +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/punit/reports/__init__.py +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/punit/runner.py +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/punit/theories/Theory.py +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/punit/theories/TheoryManager.py +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/punit/theories/__init__.py +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/punit/traits/Trait.py +0 -0
- {punit-1.2.21 → punit-1.2.23}/src/punit/traits/__init__.py +0 -0
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
# SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
4
|
import os
|
|
5
|
+
import select
|
|
6
|
+
import sys
|
|
5
7
|
from typing import Optional
|
|
6
8
|
|
|
7
9
|
from .Filter import Filter
|
|
@@ -38,13 +40,28 @@ class FilterManager:
|
|
|
38
40
|
|
|
39
41
|
def load(self, filepath:str) -> None:
|
|
40
42
|
# treat as a filepath containing one or more filter patterns
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
lines:list[str] = []
|
|
44
|
+
if filepath == 'stdin':
|
|
45
|
+
ready, _, _ = select.select([sys.stdin], [], [], 5)
|
|
46
|
+
if not ready:
|
|
47
|
+
print('No data from stdin, aborting.')
|
|
48
|
+
sys.exit(7)
|
|
49
|
+
lines = sys.stdin.read().splitlines()
|
|
50
|
+
if len(lines) == 0:
|
|
51
|
+
print('No filters from stdin, aborting.')
|
|
52
|
+
sys.exit(6)
|
|
53
|
+
else:
|
|
54
|
+
if not os.path.exists(filepath):
|
|
55
|
+
print(f'file missing or not accessible: {filepath}')
|
|
56
|
+
sys.exit(5)
|
|
57
|
+
with open(filepath, 'rb') as f:
|
|
58
|
+
lines = f.read().decode().splitlines()
|
|
59
|
+
for line in lines:
|
|
60
|
+
line = line.split('#')[0].strip() # strip comments and prefix/postfix whitespace
|
|
61
|
+
if len(line) == 0:
|
|
62
|
+
# comments and empty lines
|
|
63
|
+
continue
|
|
64
|
+
self.__filters.append(Filter(line))
|
|
48
65
|
|
|
49
66
|
def print(self) -> None:
|
|
50
67
|
if len(FilterManager.instance().filters) > 0:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|