Skip to content

Commit

Permalink
Fix test mac os python 3.11 (#1328)
Browse files Browse the repository at this point in the history
* add test

* Skip test_autohf_classificationhead.py for MacOS py311

* Skip test/nlp/test_default.py for MacOS py311

* Check test_tune

* Check test_lexiflow

* Check test_tune

* Remove checks

* Skip test_nested_run for macos py311)

* Skip test_nested_space for macos py311

* Test tune on MacOS Python 3.11 w/o pytest

* Split tests by folder

* Skip test lexiflow for MacOS py311

* Enable test_tune for MacOS py311

* Clean up
  • Loading branch information
thinkall authored Aug 6, 2024
1 parent a68d073 commit f27f98c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/nlp/test_autohf_classificationhead.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
"textattack/bert-base-uncased-MNLI",
]

if sys.platform.startswith("darwin") and sys.version_info[0] == 3 and sys.version_info[1] == 11:
pytest.skip("skipping Python 3.11 on MacOS", allow_module_level=True)


def test_switch_1_1():
data_idx, model_path_idx = 0, 0
Expand Down
3 changes: 3 additions & 0 deletions test/nlp/test_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

from flaml.default import portfolio

if sys.platform.startswith("darwin") and sys.version_info[0] == 3 and sys.version_info[1] == 11:
pytest.skip("skipping Python 3.11 on MacOS", allow_module_level=True)


def pop_args(fit_kwargs):
fit_kwargs.pop("max_iter", None)
Expand Down
5 changes: 5 additions & 0 deletions test/tune/test_lexiflow.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import math
import sys
from collections import defaultdict

import numpy as np
import pytest
import thop
import torch
import torch.nn as nn
Expand All @@ -19,6 +21,9 @@
N_TRAIN_EXAMPLES = BATCHSIZE * 30
N_VALID_EXAMPLES = BATCHSIZE * 10

if sys.platform.startswith("darwin") and sys.version_info[0] == 3 and sys.version_info[1] == 11:
pytest.skip("skipping Python 3.11 on MacOS", allow_module_level=True)


def _BraninCurrin(config):
# Rescale brain
Expand Down
7 changes: 7 additions & 0 deletions test/tune/test_tune.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
import logging
import math
import os
import sys
import time

import pytest
import sklearn.datasets
import sklearn.metrics
import xgboost as xgb
Expand All @@ -17,6 +19,7 @@
except ImportError:
print("skip test_xgboost because ray tune cannot be imported.")


logger = logging.getLogger(__name__)
os.makedirs("logs", exist_ok=True)
logger.addHandler(logging.FileHandler("logs/tune.log"))
Expand Down Expand Up @@ -496,4 +499,8 @@ def _test_xgboost_bohb():


if __name__ == "__main__":
test_nested_run()
test_nested_space()
test_run_training_function_return_value()
test_passing_search_alg()
test_xgboost_bs()

0 comments on commit f27f98c

Please sign in to comment.