-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
creating tox env for testing using pytest framework
- Loading branch information
1 parent
b35b901
commit bd630f7
Showing
4 changed files
with
69 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# dependencies for tox environment | ||
-e . | ||
|
||
fastapi==0.110.0 | ||
hyperopt==0.2.7 | ||
imbalanced_learn==0.12.0 | ||
joblib==1.3.2 | ||
matplotlib==3.8.3 | ||
mlflow==2.11.1 | ||
numpy==1.26.4 | ||
pandas==2.2.1 | ||
pydantic==2.6.4 | ||
pytest==8.1.1 | ||
PyYAML==6.0.1 | ||
scikit_learn==1.4.1.post1 | ||
setuptools==69.1.1 | ||
streamlit==1.31.1 | ||
uvicorn==0.28.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# data is properly loading from source or not | ||
# check build_features working or not ---- done | ||
# check model training is working fine or not and model return kr rha he ki nahi | ||
# model tunning performance improve kr rha he ki nahi | ||
# check whether visualization is working fine or not, or plot return kr rha he ki nahi | ||
# check api working fine or not, response kya de rha he api glt or sahi input pr | ||
# check streamlit working fine or not, | ||
|
||
import pathlib | ||
import pytest | ||
import yaml | ||
from src.features.build_features import feat_eng | ||
from src.data.make_dataset import load_data | ||
|
||
curr_dir = pathlib.Path(__file__) | ||
home_dir = curr_dir.parent.parent | ||
|
||
params = yaml.safe_load(open(f"{home_dir.as_posix()}/params.yaml")) | ||
|
||
processed_data = params['make_dataset']['processed_data'] | ||
data_source = f'{home_dir.as_posix()}{processed_data}/train.csv' | ||
|
||
|
||
# 'request' is a fixture that provides information about the currently executing test. | ||
# It allows us to access various attributes and methods to get information about the test | ||
# environment, access fixtures, and more. | ||
# here we are accessing current parameters value using request.param | ||
@pytest.fixture(params = [data_source]) | ||
def load(request) : | ||
return feat_eng(load_data(request.param)) | ||
|
||
def test_build_features(load) : | ||
assert load.shape[1] == 20 | ||
|
||
|
||
|
||
''' | ||
tox.ini file initially khud se create karo or configure karo | ||
but ek cheez ka dhyan de ki agr test_files kisi dir me hoto kese tox.ini me mention krna he | ||
or khas baat requirements.txt dhyan se dena, local package bhi mention krna | ||
bss fix requirements.txt reload kr k testing kran hoto | ||
cmd: tox -r | ||
else cmd: tox | ||
''' |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
[flake8] | ||
max-line-length = 79 | ||
max-complexity = 10 | ||
[tox] # global settings | ||
envlist = py39 # define the list of environment to test against | ||
skipsdist = True # skip creating package | ||
|
||
[testenv] | ||
deps = -rrequirements-tox.txt # dependency | ||
commands = pytest tests/ # testcases |