Skip to content

Commit 1e195b1

Browse files
conftest is updated (typing) (#342)
1 parent bde0198 commit 1e195b1

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

tests/conftest.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,13 @@ class TestStartupData__Helper:
8080
sm_StartTS = datetime.datetime.now()
8181

8282
# --------------------------------------------------------------------
83+
@staticmethod
8384
def GetStartTS() -> datetime.datetime:
8485
assert type(__class__.sm_StartTS) == datetime.datetime # noqa: E721
8586
return __class__.sm_StartTS
8687

8788
# --------------------------------------------------------------------
89+
@staticmethod
8890
def CalcRootDir() -> str:
8991
r = os.path.abspath(__file__)
9092
r = os.path.dirname(r)
@@ -93,6 +95,7 @@ def CalcRootDir() -> str:
9395
return r
9496

9597
# --------------------------------------------------------------------
98+
@staticmethod
9699
def CalcRootLogDir() -> str:
97100
if TestConfigPropNames.TEST_CFG__LOG_DIR in os.environ:
98101
resultPath = os.environ[TestConfigPropNames.TEST_CFG__LOG_DIR]
@@ -104,6 +107,7 @@ def CalcRootLogDir() -> str:
104107
return resultPath
105108

106109
# --------------------------------------------------------------------
110+
@staticmethod
107111
def CalcCurrentTestWorkerSignature() -> str:
108112
currentPID = os.getpid()
109113
assert type(currentPID) == int # noqa: E721
@@ -142,16 +146,19 @@ class TestStartupData:
142146
sm_RootLogDir: str = TestStartupData__Helper.CalcRootLogDir()
143147

144148
# --------------------------------------------------------------------
149+
@staticmethod
145150
def GetRootDir() -> str:
146151
assert type(__class__.sm_RootDir) == str # noqa: E721
147152
return __class__.sm_RootDir
148153

149154
# --------------------------------------------------------------------
155+
@staticmethod
150156
def GetRootLogDir() -> str:
151157
assert type(__class__.sm_RootLogDir) == str # noqa: E721
152158
return __class__.sm_RootLogDir
153159

154160
# --------------------------------------------------------------------
161+
@staticmethod
155162
def GetCurrentTestWorkerSignature() -> str:
156163
assert type(__class__.sm_CurrentTestWorkerSignature) == str # noqa: E721
157164
return __class__.sm_CurrentTestWorkerSignature
@@ -186,6 +193,7 @@ class TEST_PROCESS_STATS:
186193
cTotalWarnings: int = 0
187194

188195
# --------------------------------------------------------------------
196+
@staticmethod
189197
def incrementTotalTestCount() -> None:
190198
assert type(__class__.cTotalTests) == int # noqa: E721
191199
assert __class__.cTotalTests >= 0
@@ -195,6 +203,7 @@ def incrementTotalTestCount() -> None:
195203
assert __class__.cTotalTests > 0
196204

197205
# --------------------------------------------------------------------
206+
@staticmethod
198207
def incrementNotExecutedTestCount() -> None:
199208
assert type(__class__.cNotExecutedTests) == int # noqa: E721
200209
assert __class__.cNotExecutedTests >= 0
@@ -204,6 +213,7 @@ def incrementNotExecutedTestCount() -> None:
204213
assert __class__.cNotExecutedTests > 0
205214

206215
# --------------------------------------------------------------------
216+
@staticmethod
207217
def incrementExecutedTestCount() -> int:
208218
assert type(__class__.cExecutedTests) == int # noqa: E721
209219
assert __class__.cExecutedTests >= 0
@@ -214,6 +224,7 @@ def incrementExecutedTestCount() -> int:
214224
return __class__.cExecutedTests
215225

216226
# --------------------------------------------------------------------
227+
@staticmethod
217228
def incrementPassedTestCount() -> None:
218229
assert type(__class__.cPassedTests) == int # noqa: E721
219230
assert __class__.cPassedTests >= 0
@@ -223,6 +234,7 @@ def incrementPassedTestCount() -> None:
223234
assert __class__.cPassedTests > 0
224235

225236
# --------------------------------------------------------------------
237+
@staticmethod
226238
def incrementFailedTestCount(testID: str, errCount: int) -> None:
227239
assert type(testID) == str # noqa: E721
228240
assert type(errCount) == int # noqa: E721
@@ -247,6 +259,7 @@ def incrementFailedTestCount(testID: str, errCount: int) -> None:
247259
assert __class__.cTotalErrors > 0
248260

249261
# --------------------------------------------------------------------
262+
@staticmethod
250263
def incrementXFailedTestCount(testID: str, errCount: int) -> None:
251264
assert type(testID) == str # noqa: E721
252265
assert type(errCount) == int # noqa: E721
@@ -263,6 +276,7 @@ def incrementXFailedTestCount(testID: str, errCount: int) -> None:
263276
assert len(__class__.XFailedTests) == __class__.cXFailedTests
264277

265278
# --------------------------------------------------------------------
279+
@staticmethod
266280
def incrementSkippedTestCount() -> None:
267281
assert type(__class__.cSkippedTests) == int # noqa: E721
268282
assert __class__.cSkippedTests >= 0
@@ -272,6 +286,7 @@ def incrementSkippedTestCount() -> None:
272286
assert __class__.cSkippedTests > 0
273287

274288
# --------------------------------------------------------------------
289+
@staticmethod
275290
def incrementNotXFailedTests(testID: str) -> None:
276291
assert type(testID) == str # noqa: E721
277292
assert type(__class__.NotXFailedTests) == list # noqa: E721
@@ -286,6 +301,7 @@ def incrementNotXFailedTests(testID: str) -> None:
286301
assert len(__class__.NotXFailedTests) == __class__.cNotXFailedTests
287302

288303
# --------------------------------------------------------------------
304+
@staticmethod
289305
def incrementWarningTestCount(testID: str, warningCount: int) -> None:
290306
assert type(testID) == str # noqa: E721
291307
assert type(warningCount) == int # noqa: E721
@@ -311,6 +327,7 @@ def incrementWarningTestCount(testID: str, warningCount: int) -> None:
311327
assert __class__.cTotalWarnings > 0
312328

313329
# --------------------------------------------------------------------
330+
@staticmethod
314331
def incrementUnexpectedTests() -> None:
315332
assert type(__class__.cUnexpectedTests) == int # noqa: E721
316333
assert __class__.cUnexpectedTests >= 0
@@ -320,6 +337,7 @@ def incrementUnexpectedTests() -> None:
320337
assert __class__.cUnexpectedTests > 0
321338

322339
# --------------------------------------------------------------------
340+
@staticmethod
323341
def incrementAchtungTestCount(testID: str) -> None:
324342
assert type(testID) == str # noqa: E721
325343
assert type(__class__.AchtungTests) == list # noqa: E721
@@ -671,7 +689,7 @@ def pytest_runtest_makereport(item: pytest.Function, call: pytest.CallInfo):
671689

672690

673691
class LogWrapper2:
674-
_old_method: any
692+
_old_method: typing.Any
675693
_err_counter: typing.Optional[int]
676694
_warn_counter: typing.Optional[int]
677695

@@ -1089,9 +1107,7 @@ def helper__pytest_configure__logging(config: pytest.Config) -> None:
10891107

10901108
pathlib.Path(log_dir).mkdir(exist_ok=True)
10911109

1092-
logging_plugin: _pytest.logging.LoggingPlugin = config.pluginmanager.get_plugin(
1093-
"logging-plugin"
1094-
)
1110+
logging_plugin = config.pluginmanager.get_plugin("logging-plugin")
10951111

10961112
assert logging_plugin is not None
10971113
assert isinstance(logging_plugin, _pytest.logging.LoggingPlugin)

0 commit comments

Comments
 (0)