Skip to content

A programming framework for agentic AI

Add conda forge minimal test (#309)

Michal Chromcakb0ef3b79957f
diff --git a/pytest.ini b/pytest.ini
new file mode 100644
index 000000000..a3d5dcd6a
--- /dev/null
+++ b/pytest.ini
@@ -0,0 +1,5 @@
+[pytest]
+addopts = -m "not conda"
+markers =
+ conda: test related to conda forge distribution
+
diff --git a/test/test_conda_distribution.py b/test/test_conda_distribution.py
new file mode 100644
index 000000000..a028cec95
--- /dev/null
+++ b/test/test_conda_distribution.py
@@ -0,0 +1,30 @@
+import pytest
+from pathlib import Path
+from flaml import AutoML
+from sklearn.datasets import load_iris
+
+
+def test_package_minimum():
+ # Initialize an AutoML instance
+ automl = AutoML()
+ # Specify automl goal and constraint
+ automl_settings = {
+ "time_budget": 10, # in seconds
+ "metric": 'accuracy',
+ "task": 'classification',
+ "log_file_name": "iris.log",
+ }
+ X_train, y_train = load_iris(return_X_y=True)
+ # Train with labeled input data
+ automl.fit(X_train=X_train, y_train=y_train, **automl_settings)
+ # Check that `best_config` is created, the log was created and best model is accessible
+ assert hasattr(automl, "best_config")
+ assert Path("iris.log").exists()
+ assert automl.model is not None
+ print(automl.model)
+ # Predict and check that the prediction shape is as expected
+ preds = automl.predict_proba(X_train)
+ assert preds.shape == (150, 3)
+ print(preds)
+