Skip to content

Commit 8c21f5d

Browse files
committed
added helper method skip__if_not__in_github_actions
and used it in this project
1 parent fc5f7c4 commit 8c21f5d

File tree

8 files changed

+15
-14
lines changed

8 files changed

+15
-14
lines changed

osbot_utils/testing/Pytest.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from osbot_utils.utils.Env import get_env, load_dotenv, in_python_debugger, in_github_action
1+
from osbot_utils.utils.Env import get_env, load_dotenv, in_python_debugger, in_github_action, not_in_github_action
22

33
needs_load_dotenv = True
44

@@ -19,4 +19,8 @@ def skip__if_in_python_debugger():
1919

2020
def skip_if_in_github_action():
2121
if in_github_action():
22-
skip_pytest("Skipping test because we are in a github action")
22+
skip_pytest("Skipping test because we are in a github action")
23+
24+
def skip__if_not__in_github_actions():
25+
if not_in_github_action():
26+
skip_pytest('For performance reasons only run this test in GitHub Actions')

osbot_utils/utils/Env.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ def in_github_action():
117117

118118
return os.getenv('GITHUB_ACTIONS') == 'true'
119119

120+
def not_in_github_action():
121+
return in_github_action() is False
122+
120123
def in_pytest_with_coverage():
121124
import os
122125

tests/unit/helpers/timestamp_capture/decorators/test_timestamp.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import time
22
from unittest import TestCase
3-
4-
from osbot_fast_api_serverless.utils.testing.skip_tests import skip__if_not__in_github_actions
5-
3+
from osbot_utils.testing.Pytest import skip__if_not__in_github_actions
64
from osbot_utils.helpers.timestamp_capture.Timestamp_Collector import Timestamp_Collector
75
from osbot_utils.helpers.timestamp_capture.decorators.timestamp import timestamp
86
from osbot_utils.type_safe.Type_Safe import Type_Safe

tests/unit/helpers/timestamp_capture/decorators/test_timestamp_block.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import time
22
from unittest import TestCase
3-
4-
from osbot_fast_api_serverless.utils.testing.skip_tests import skip__if_not__in_github_actions
5-
3+
from osbot_utils.testing.Pytest import skip__if_not__in_github_actions
64
from osbot_utils.helpers.timestamp_capture.Timestamp_Collector import Timestamp_Collector
75
from osbot_utils.helpers.timestamp_capture.context_managers.timestamp_block import timestamp_block
86

tests/unit/helpers/timestamp_capture/test_Timestamp_Collector.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import threading
22
from unittest import TestCase
3-
4-
from osbot_fast_api_serverless.utils.testing.skip_tests import skip__if_not__in_github_actions
5-
3+
from osbot_utils.testing.Pytest import skip__if_not__in_github_actions
64
from osbot_utils.helpers.timestamp_capture.Timestamp_Collector import Timestamp_Collector
75
from osbot_utils.helpers.timestamp_capture.schemas.Schema__Timestamp_Entry import Schema__Timestamp_Entry
86
from osbot_utils.type_safe.Type_Safe import Type_Safe

tests/unit/helpers/timestamp_capture/test_Timestamp_Collector__Analysis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import time
22
from unittest import TestCase
3-
from osbot_fast_api_serverless.utils.testing.skip_tests import skip__if_not__in_github_actions
3+
from osbot_utils.testing.Pytest import skip__if_not__in_github_actions
44
from osbot_utils.helpers.timestamp_capture.Timestamp_Collector import Timestamp_Collector
55
from osbot_utils.helpers.timestamp_capture.Timestamp_Collector__Analysis import Timestamp_Collector__Analysis
66
from osbot_utils.helpers.timestamp_capture.schemas.Schema__Method_Timing import Schema__Method_Timing

tests/unit/helpers/timestamp_capture/test_Timestamp_Collector__Report.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import time
22
from unittest import TestCase
33

4-
from osbot_fast_api_serverless.utils.testing.skip_tests import skip__if_not__in_github_actions
4+
from osbot_utils.testing.Pytest import skip__if_not__in_github_actions
55

66
from osbot_utils.helpers.timestamp_capture.Timestamp_Collector import Timestamp_Collector
77
from osbot_utils.helpers.timestamp_capture.Timestamp_Collector__Report import Timestamp_Collector__Report

tests/unit/helpers/timestamp_capture/test_Timestamp_Collector__integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import time as time_module
22
from unittest import TestCase
3-
from osbot_aws.testing.skip_tests import skip__if_not__in_github_actions
43
from osbot_utils.helpers.timestamp_capture.Timestamp_Collector import Timestamp_Collector
54
from osbot_utils.helpers.timestamp_capture.Timestamp_Collector__Analysis import Timestamp_Collector__Analysis
65
from osbot_utils.helpers.timestamp_capture.Timestamp_Collector__Report import Timestamp_Collector__Report
76
from osbot_utils.helpers.timestamp_capture.context_managers.timestamp_block import timestamp_block
87
from osbot_utils.helpers.timestamp_capture.decorators.timestamp import timestamp
8+
from osbot_utils.testing.Pytest import skip__if_not__in_github_actions
99
from osbot_utils.type_safe.Type_Safe import Type_Safe
1010

1111

0 commit comments

Comments
 (0)