Skip to content

Commit

Permalink
fix: coverage workflow to test workflow with ENV
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-min committed Jan 24, 2024
1 parent 349002c commit 4daf30f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 14 deletions.
Binary file modified .coverage
Binary file not shown.
12 changes: 10 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,18 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.10.12

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt # 프로젝트에 필요한 경우
- name: Run tests with coverage
run: |
pytest --cov-report term --cov=.
- name: Upload coverage results
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./.coverage
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ __pycache__
.pytest_cache
conf
img
htmlcov
htmlcov
.env
.coverage
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pytest==7.4.4
pytest-asyncio==0.23.3
pytest-cov==4.1.0
pytest-order==1.2.0
python-dotenv==1.0.1
python-multipart==0.0.6
sniffio==1.3.0
starlette==0.35.1
Expand Down
10 changes: 2 additions & 8 deletions src/libs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import os
import json
from dotenv import load_dotenv

apps_path = os.path.abspath(os.path.join(__file__, os.path.pardir))
conf_path = os.path.abspath(os.path.join(apps_path, "conf"))

conf_file = os.path.abspath(os.path.join(conf_path, "conf.json"))
with open(conf_file, "rt") as f:
conf = json.load(f)
load_dotenv()
8 changes: 5 additions & 3 deletions src/libs/db_manager.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import os
import pymongo
from . import conf
from .exception import DBError
from .error_code import DBErrorCode


class MongoManager:
def __init__(self, url: str = conf["mongo"]["CONNECTION_URL"]) -> None:
def __init__(
self, url: str = os.environ.get('MONGO_CONNECTION_URL')
) -> None:
self.url = url
self.db = conf["mongo"]["DB_NAME"]
self.db = os.environ.get('DB_NAME')

def get_session(self) -> pymongo.MongoClient:
try:
Expand Down

0 comments on commit 4daf30f

Please sign in to comment.