From 0dc5cf3468d0c71ee9d07f1090a6be135f9eba2d Mon Sep 17 00:00:00 2001 From: K-dash Date: Wed, 29 May 2024 12:00:05 +0900 Subject: [PATCH] Move tests directory outside of src --- .github/workflows/pytest.yml | 1 - pyproject.toml | 4 ++++ src/api.py | 2 +- src/helper.py | 4 ++-- {src/tests => tests}/__init__.py | 0 {src/tests => tests}/test_code.py | 3 --- 6 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 pyproject.toml rename {src/tests => tests}/__init__.py (100%) rename {src/tests => tests}/test_code.py (98%) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 9b5096c..9e95801 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -20,5 +20,4 @@ jobs: pip install pytest - name: Test with pytest run: | - cd src pytest diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..d253baf --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,4 @@ +# pytest settings +[tool.pytest.ini_options] +pythonpath = "." +addopts = '-p no:warnings' # disable pytest warnings diff --git a/src/api.py b/src/api.py index abb9a80..9bcb808 100644 --- a/src/api.py +++ b/src/api.py @@ -8,7 +8,7 @@ from retry_requests import retry import requests import pandas as pd -import helper +from src import helper def get_coordinates(args): diff --git a/src/helper.py b/src/helper.py index fb5b133..240f757 100644 --- a/src/helper.py +++ b/src/helper.py @@ -3,8 +3,8 @@ """ import json -import api -import art +from src import api +from src import art import pandas as pd diff --git a/src/tests/__init__.py b/tests/__init__.py similarity index 100% rename from src/tests/__init__.py rename to tests/__init__.py diff --git a/src/tests/test_code.py b/tests/test_code.py similarity index 98% rename from src/tests/test_code.py rename to tests/test_code.py index dfc3d36..80e1f59 100644 --- a/src/tests/test_code.py +++ b/tests/test_code.py @@ -5,9 +5,6 @@ """ import sys - -sys.path.append("../src") - from unittest.mock import patch import io import time