Skip to content

Commit

Permalink
setup vscode to play nice with pixi, add pytest to pixi toml
Browse files Browse the repository at this point in the history
  • Loading branch information
GondekNP committed Jan 9, 2025
1 parent 9209bbd commit 51b469b
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"ms-python.flake8",
"ms-python.python",
"ms-python.debugpy",
"ms-python.black-formatter"
"ms-python.black-formatter",
"jjjermiah.pixi-vscode"
],
"postCreateCommand": ".devcontainer/scripts/transfer_local_dev_cache.sh"
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.defaultInterpreterPath": "/workspaces/mesa_abm_poc/.pixi/envs/default/bin/python"
}
54 changes: 54 additions & 0 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ platforms = ["linux-64"]
[tasks]

[dependencies]
pytest = ">=7.4.4,<7.5"

[target.linux-64.dependencies]
python = "3.11.*"
Expand Down
24 changes: 14 additions & 10 deletions tests/integration/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pandas as pd
import pytest


def test_batch_run_basic():
# Set up minimal test parameters
test_params = {
Expand All @@ -12,7 +13,7 @@ def test_batch_run_basic():
"export_data": [False],
"bounds": [TST_JOTR_BOUNDS],
}

# Run simulation with minimal parameters
results = batch_run(
Vegetation,
Expand All @@ -23,21 +24,24 @@ def test_batch_run_basic():
data_collection_period=1,
display_progress=False,
)

# Basic validation
assert isinstance(results, pd.DataFrame)
assert len(results) > 0

# Check expected columns exist
expected_columns = {
'Run', 'iteration', 'Step',
'management_planting_density',
'num_steps', 'export_data'
"Run",
"iteration",
"Step",
"management_planting_density",
"num_steps",
"export_data",
}
assert all(col in results.columns for col in expected_columns)

# Verify we got correct number of steps
assert results['Step'].max() == 3
assert results["Step"].max() == 3

# Verify we got results for both density values
assert len(results['management_planting_density'].unique()) == 2
assert len(results["management_planting_density"].unique()) == 2

0 comments on commit 51b469b

Please sign in to comment.