Skip to content

Commit f3931e2

Browse files
committed
Refactor test files to replace 'stress_framework' with 'gradual' in import paths
- Updated import statements in test_orchestrator.py, test_parser.py, test_phase.py, and test_runner.py to reflect the new package name. - Ensured all relevant patches and mock setups are aligned with the updated package structure.
1 parent fa26779 commit f3931e2

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

tests/test_orchestrator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ def mock_parser(mock_scenario_config):
6363

6464
@pytest.fixture
6565
def orchestrator(mock_parser):
66-
with patch("stress_framework.base.orchestrator.Parser", return_value=mock_parser):
66+
with patch("gradual.base.orchestrator.Parser", return_value=mock_parser):
6767
orch = Orchestrator("test_config.json", "request_configs.json")
6868
orch.parser = mock_parser
6969
return orch
7070

7171

7272
def test_orchestrator_initialization():
7373
"""Test that Orchestrator initializes correctly with config paths."""
74-
with patch("stress_framework.base.orchestrator.Parser") as mock_parser:
74+
with patch("gradual.base.orchestrator.Parser") as mock_parser:
7575
orch = Orchestrator("test_config.json", "request_configs.json")
7676
mock_parser.assert_called_once_with("test_config.json", "request_configs.json")
7777
assert orch.test_config_file_path == "test_config.json"

tests/test_parser.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from gradual.configs.scenario import ScenarioConfig
66
from gradual.configs.request import RequestConfig
77

8-
# filepath: src/stress_framework/configs/test_parser.py
8+
# filepath: src/gradual/configs/test_parser.py
99

1010

1111
@pytest.fixture
@@ -54,7 +54,7 @@ def mock_request_yaml_data():
5454

5555
@patch("builtins.open", new_callable=mock_open)
5656
@patch("yaml.safe_load")
57-
@patch("stress_framework.configs.parser.assert_not_empty")
57+
@patch("gradual.configs.parser.assert_not_empty")
5858
def test_read_configs(
5959
mock_assert_not_empty,
6060
mock_yaml_safe_load,
@@ -112,7 +112,7 @@ def test_read_configs(
112112

113113
@patch("builtins.open", new_callable=mock_open)
114114
@patch("yaml.safe_load")
115-
@patch("stress_framework.configs.parser.assert_not_empty")
115+
@patch("gradual.configs.parser.assert_not_empty")
116116
def test_parser_multiple_phases_and_scenarios(
117117
mock_assert_not_empty, mock_yaml_safe_load, mock_open_file
118118
):
@@ -203,7 +203,7 @@ def test_parser_multiple_phases_and_scenarios(
203203

204204
@patch("builtins.open", new_callable=mock_open)
205205
@patch("yaml.safe_load")
206-
@patch("stress_framework.configs.parser.assert_not_empty")
206+
@patch("gradual.configs.parser.assert_not_empty")
207207
def test_parser_missing_required_fields_raises(
208208
mock_assert_not_empty, mock_yaml_safe_load, mock_open_file
209209
):
@@ -216,7 +216,7 @@ def test_parser_missing_required_fields_raises(
216216

217217
@patch("builtins.open", new_callable=mock_open)
218218
@patch("yaml.safe_load")
219-
@patch("stress_framework.configs.parser.assert_not_empty")
219+
@patch("gradual.configs.parser.assert_not_empty")
220220
def test_parser_invalid_ramp_up_type_raises(
221221
mock_assert_not_empty, mock_yaml_safe_load, mock_open_file
222222
):
@@ -259,7 +259,7 @@ def test_parser_invalid_ramp_up_type_raises(
259259

260260
@patch("builtins.open", new_callable=mock_open)
261261
@patch("yaml.safe_load")
262-
@patch("stress_framework.configs.parser.assert_not_empty")
262+
@patch("gradual.configs.parser.assert_not_empty")
263263
def test_parser_optional_fields(
264264
mock_assert_not_empty, mock_yaml_safe_load, mock_open_file
265265
):

tests/test_phase.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ def mock_phase_config():
2727
def test_phase_initialization(mock_phase_config):
2828
"""Test that Phase initializes correctly with config and run name."""
2929
with (
30-
patch("stress_framework.runners.phase.Stats") as mock_stats,
31-
patch("stress_framework.runners.phase.Runner") as mock_runner,
30+
patch("gradual.runners.phase.Stats") as mock_stats,
31+
patch("gradual.runners.phase.Runner") as mock_runner,
3232
):
3333
phase = Phase(mock_phase_config, "test_run")
3434
mock_stats.assert_called_once_with(mock_phase_config, "test_run")
@@ -41,8 +41,8 @@ def test_phase_initialization(mock_phase_config):
4141
def test_phase_execution(mock_phase_config):
4242
"""Test normal phase execution without timeout."""
4343
with (
44-
patch("stress_framework.runners.phase.Stats"),
45-
patch("stress_framework.runners.phase.Runner") as mock_runner,
44+
patch("gradual.runners.phase.Stats"),
45+
patch("gradual.runners.phase.Runner") as mock_runner,
4646
):
4747
phase = Phase(mock_phase_config, "test_run")
4848
phase.runner.start_test = Mock()
@@ -65,8 +65,8 @@ def test_phase_execution(mock_phase_config):
6565
def test_phase_timeout(mock_phase_config):
6666
"""Test phase execution with timeout."""
6767
with (
68-
patch("stress_framework.runners.phase.Stats"),
69-
patch("stress_framework.runners.phase.Runner") as mock_runner,
68+
patch("gradual.runners.phase.Stats"),
69+
patch("gradual.runners.phase.Runner") as mock_runner,
7070
):
7171
phase = Phase(mock_phase_config, "test_run")
7272
phase.runner.stop_runner = Mock()
@@ -84,8 +84,8 @@ def test_phase_timeout(mock_phase_config):
8484
def test_stop_phase(mock_phase_config):
8585
"""Test stopping a phase."""
8686
with (
87-
patch("stress_framework.runners.phase.Stats"),
88-
patch("stress_framework.runners.phase.Runner") as mock_runner,
87+
patch("gradual.runners.phase.Stats"),
88+
patch("gradual.runners.phase.Runner") as mock_runner,
8989
):
9090
phase = Phase(mock_phase_config, "test_run")
9191
phase.runner.stop_runner = Mock()
@@ -96,8 +96,8 @@ def test_stop_phase(mock_phase_config):
9696
def test_phase_execution_error_handling(mock_phase_config):
9797
"""Test error handling during phase execution."""
9898
with (
99-
patch("stress_framework.runners.phase.Stats"),
100-
patch("stress_framework.runners.phase.Runner") as mock_runner,
99+
patch("gradual.runners.phase.Stats"),
100+
patch("gradual.runners.phase.Runner") as mock_runner,
101101
):
102102
phase = Phase(mock_phase_config, "test_run")
103103
phase.runner.stop_runner = Mock()

tests/test_runner.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ def mock_scenario_configs():
3636

3737
@pytest.fixture
3838
def runner(mock_scenario_configs):
39-
with patch("stress_framework.runners.runner.Scenario") as mock_scenario:
39+
with patch("gradual.runners.runner.Scenario") as mock_scenario:
4040
mock_scenario.return_value = Mock()
4141
runner = Runner(mock_scenario_configs)
4242
return runner
4343

4444

4545
def test_runner_initialization(mock_scenario_configs):
4646
"""Test that Runner initializes correctly with scenario configs."""
47-
with patch("stress_framework.runners.runner.Scenario") as mock_scenario:
47+
with patch("gradual.runners.runner.Scenario") as mock_scenario:
4848
mock_scenario.return_value = Mock()
4949
runner = Runner(mock_scenario_configs)
5050

@@ -139,9 +139,9 @@ def get_next_request(self):
139139
with (
140140
patch("gevent.spawn") as mock_spawn,
141141
patch("gevent.wait") as mock_wait,
142-
patch("stress_framework.runners.runner.Scenario") as mock_scenario,
143-
patch("stress_framework.runners.scenario._Request", MockRequest),
144-
patch("stress_framework.runners.scenario.RequestIterator", MockIterator),
142+
patch("gradual.runners.runner.Scenario") as mock_scenario,
143+
patch("gradual.runners.scenario._Request", MockRequest),
144+
patch("gradual.runners.scenario.RequestIterator", MockIterator),
145145
):
146146
# Create a new mock for each scenario
147147
mock_instances = []

0 commit comments

Comments
 (0)