Skip to content

Commit

Permalink
Fixups for running pytest via VSCode (#933)
Browse files Browse the repository at this point in the history
# Pull Request

## Title

Fixups for running pytest via VSCode

______________________________________________________________________

## Description

@motus noticed that running all tests in VSCode was hanging inside a
DevContainer on MacOS.

After some debugging I determined that there was some mismatch between
discovering tests and running them, specifically for the
GridSearchOptimizer. This was true on the CLI as well.

Adding it to the `__init__.py` for that submodule seems to fix the
issue.

______________________________________________________________________

## Type of Change

- 🛠️ Bug fix

______________________________________________________________________

## Testing

- Local VSCode in both DevContainer and MacOS native mode.

______________________________________________________________________

## Additional Notes (optional)

Don't know of others like this but I wonder if that's an issue now ...

______________________________________________________________________
  • Loading branch information
bpkroth authored Jan 17, 2025
1 parent 0cab884 commit 662b79d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions mlos_bench/mlos_bench/optimizers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@
"""

from mlos_bench.optimizers.base_optimizer import Optimizer
from mlos_bench.optimizers.grid_search_optimizer import GridSearchOptimizer
from mlos_bench.optimizers.manual_optimizer import ManualOptimizer
from mlos_bench.optimizers.mlos_core_optimizer import MlosCoreOptimizer
from mlos_bench.optimizers.mock_optimizer import MockOptimizer
from mlos_bench.optimizers.one_shot_optimizer import OneShotOptimizer

__all__ = [
"Optimizer",
"GridSearchOptimizer",
"ManualOptimizer",
"MlosCoreOptimizer",
"MockOptimizer",
"OneShotOptimizer",
"MlosCoreOptimizer",
"Optimizer",
]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"class": "mlos_bench.optimizers.grid_search_optimizer.GridSearchOptimizer"
"class": "mlos_bench.optimizers.GridSearchOptimizer"
// no config required
}
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,7 @@ def test_optimizer_configs_with_extra_param(test_case_name: str) -> None:
TEST_CASES.by_type["good"][test_case_name],
ConfigSchema.UNIFIED,
)


if __name__ == "__main__":
pytest.main(args=["-n0", "-k", "grid_search_optimizer"])

0 comments on commit 662b79d

Please sign in to comment.