Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-format code by autopep8 #282

Merged
merged 1 commit into from
Nov 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions tests/integration/test_waccm_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
from acom_music_box.tools.waccmToMusicBox import main as waccmToMusicBoxMain
from acom_music_box import Examples


@pytest.fixture
def temp_dir():
with tempfile.TemporaryDirectory(delete=False) as tmpdirname:
yield tmpdirname


def get_repo_root():
return os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))


def run_waccm_to_music_box_with_args(args, cwd):
original_argv = sys.argv
original_cwd = os.getcwd()
Expand All @@ -24,10 +27,11 @@ def run_waccm_to_music_box_with_args(args, cwd):
os.chdir(original_cwd)
sys.argv = original_argv


def test_waccm_to_music_box_conversion(temp_dir):
repo_root = get_repo_root()
sample_data_dir = os.path.join(repo_root, "sample_waccm_data")

# Set up arguments for the conversion
args = [
f"waccmDir={sample_data_dir}",
Expand All @@ -37,10 +41,10 @@ def test_waccm_to_music_box_conversion(temp_dir):
"longitude=101.7",
"output=csv,json"
]

# Run the waccmToMusicBox script with the arguments
run_waccm_to_music_box_with_args(args, temp_dir)

# Check if the output files are created
assert os.path.exists(os.path.join(os.path.dirname(Examples.TS1.path), "initial_conditions.csv"))
assert os.path.exists(os.path.join(os.path.dirname(Examples.TS1.path), "initial_config.json"))
Expand Down