Skip to content

Commit 4005794

Browse files
committed
project: exclude test scenarios
1 parent 7df8fb6 commit 4005794

File tree

6 files changed

+13
-19
lines changed

6 files changed

+13
-19
lines changed

resources/networks/6_node_bitcoin/network.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,5 @@ nodes:
2828
connect:
2929
- tank-0006
3030
- name: tank-0006
31-
fork_observer:
32-
enabled: true
3331
caddy:
3432
enabled: true

src/warnet/graph.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def custom_graph(
7474
yaml.dump(network_yaml_data, f, default_flow_style=False)
7575

7676
# Generate node-defaults.yaml
77-
default_yaml_path = files("resources.networks").joinpath("node-defaults.yaml")
77+
default_yaml_path = files("resources.networks").joinpath("fork_observer").joinpath("node-defaults.yaml")
7878
with open(str(default_yaml_path)) as f:
7979
defaults_yaml_content = yaml.safe_load(f)
8080

src/warnet/network.py

+9-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
import re
23
import shutil
34
from pathlib import Path
45

@@ -18,17 +19,12 @@ def copy_defaults(directory: Path, target_subdir: str, source_path: Path, exclud
1819
target_dir.mkdir(parents=True, exist_ok=True)
1920
print(f"Creating directory: {target_dir}")
2021

21-
def should_copy(item: Path) -> bool:
22-
return item.name not in exclude_list
23-
24-
for item in source_path.iterdir():
25-
if should_copy(item):
26-
if item.is_file():
27-
shutil.copy2(item, target_dir)
28-
print(f"Copied file: {item.name}")
29-
elif item.is_dir():
30-
shutil.copytree(item, target_dir / item.name, dirs_exist_ok=True)
31-
print(f"Copied directory: {item.name}")
22+
shutil.copytree(
23+
src=source_path,
24+
dst=target_dir,
25+
dirs_exist_ok=True,
26+
ignore=shutil.ignore_patterns(*exclude_list)
27+
)
3228

3329
print(f"Finished copying files to {target_dir}")
3430

@@ -39,7 +35,7 @@ def copy_network_defaults(directory: Path):
3935
directory,
4036
NETWORK_DIR.name,
4137
NETWORK_DIR,
42-
["node-defaults.yaml", "__pycache__", "__init__.py"],
38+
["__pycache__", "__init__.py"],
4339
)
4440

4541

@@ -49,7 +45,7 @@ def copy_scenario_defaults(directory: Path):
4945
directory,
5046
SCENARIOS_DIR.name,
5147
SCENARIOS_DIR,
52-
["__init__.py", "__pycache__", "commander.py"],
48+
["__pycache__", "TEST_*.py"],
5349
)
5450

5551

test/dag_connection_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def setup_network(self):
2626

2727
def run_connect_dag_scenario(self):
2828
self.log.info("Running connect_dag scenario")
29-
self.warnet("run resources/scenarios/test_connect_dag.py")
29+
self.warnet("run resources/scenarios/TEST_connect_dag.py")
3030
self.wait_for_all_scenarios()
3131

3232

test/scenarios_test.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def run_and_check_miner_scenario_from_file(self):
8282
self.stop_scenario()
8383

8484
def run_and_check_scenario_from_file(self):
85-
scenario_file = "resources/scenarios/test_p2p_interface.py"
85+
scenario_file = "resources/scenarios/TEST_p2p_interface.py"
8686
self.log.info(f"Running scenario from: {scenario_file}")
8787
self.warnet(f"run {scenario_file}")
8888
self.wait_for_predicate(self.check_scenario_clean_exit)
@@ -94,7 +94,7 @@ def check_regtest_recon(self):
9494
self.wait_for_predicate(self.check_scenario_clean_exit)
9595

9696
def check_active_count(self):
97-
scenario_file = "resources/scenarios/test_buggy_failure.py"
97+
scenario_file = "resources/scenarios/TEST_buggy_failure.py"
9898
self.log.info(f"Running scenario from: {scenario_file}")
9999
self.warnet(f"run {scenario_file}")
100100

0 commit comments

Comments
 (0)