Skip to content

Commit

Permalink
Merge pull request #174 from tsugumi-sys/feature/remove-session-local…
Browse files Browse the repository at this point in the history
…-import

techdebt: remove sessionlocal import
  • Loading branch information
tsugumi-sys authored Jul 7, 2024
2 parents 9b02932 + f18f856 commit 3baf777
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 14 deletions.
3 changes: 1 addition & 2 deletions tests/nasdaqapi/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import pytest
from click.testing import CliRunner

from conftest import SessionLocal # noqa: F401
from stocklake.exceptions import StockLakeException
from stocklake.nasdaqapi import cli
from stocklake.nasdaqapi.constants import Exchange
Expand Down Expand Up @@ -43,7 +42,7 @@ def test_nasdaqapi(
store_type,
MockNasdaqAPIServer, # noqa: F811
monkeypatch,
SessionLocal, # noqa: F811
SessionLocal,
):
monkeypatch.setenv("_STOCKLAKE_ENVIRONMENT", "test")
monkeypatch.setenv("STOCKLAKE_POLYGON_API_KEY", "dummy_key")
Expand Down
3 changes: 1 addition & 2 deletions tests/nasdaqapi/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import pytest

from conftest import SessionLocal # noqa: F401
from stocklake.exceptions import StockLakeException
from stocklake.nasdaqapi.constants import Exchange
from stocklake.nasdaqapi.pipeline import NASDAQSymbolsPipeline
Expand Down Expand Up @@ -54,7 +53,7 @@ def test_run_with_local_artifact(tmpdir, MockNasdaqAPIServer): # noqa: F811
def test_run_each_symbols_with_postgresql(
exchange,
tmpdir,
SessionLocal, # noqa: F811,
SessionLocal,
MockNasdaqAPIServer, # noqa: F811
):
pipeline = NASDAQSymbolsPipeline(
Expand Down
1 change: 0 additions & 1 deletion tests/nasdaqapi/test_stores.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import pytest

from conftest import SessionLocal # noqa: F401
from stocklake.nasdaqapi.constants import Exchange
from stocklake.nasdaqapi.entities import NasdaqApiDataCreate
from stocklake.nasdaqapi.stores import (
Expand Down
3 changes: 1 addition & 2 deletions tests/polygonapi/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import pytest
from click.testing import CliRunner

from conftest import SessionLocal # noqa: F401
from stocklake.exceptions import StockLakeException
from stocklake.polygonapi import cli
from stocklake.polygonapi.constants import PolygonAPIType
Expand Down Expand Up @@ -56,7 +55,7 @@ def test_polygonapi_stock_financials_vx(
store_type,
MockPolygonAPIServer, # noqa: F811
monkeypatch,
SessionLocal, # noqa: F811
SessionLocal,
):
monkeypatch.setenv("_STOCKLAKE_ENVIRONMENT", "test")
monkeypatch.setenv("STOCKLAKE_POLYGON_API_KEY", "dummy_key")
Expand Down
3 changes: 1 addition & 2 deletions tests/polygonapi/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import pytest

from conftest import SessionLocal # noqa: F401
from stocklake.exceptions import StockLakeException
from stocklake.polygonapi.pipeline import PolygonFinancialsDataPipeline
from stocklake.polygonapi.stores import SAVE_ARTIFACTS_DIR
Expand Down Expand Up @@ -36,7 +35,7 @@ def test_run_with_local_artifact(MockPolygonAPIServer, monkeypatch): # noqa: F8
def test_run_with_postgresql(
MockPolygonAPIServer, # noqa: F811
monkeypatch,
SessionLocal, # noqa: F811
SessionLocal,
):
monkeypatch.setenv("STOCKLAKE_POLYGON_API_KEY", "dummy_key")
pipeline = PolygonFinancialsDataPipeline(
Expand Down
7 changes: 3 additions & 4 deletions tests/polygonapi/test_stores.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import pytest

from conftest import SessionLocal # noqa: F401
from stocklake.environment_variables import STOCKLAKE_POLYGON_API_KEY
from stocklake.polygonapi import entities
from stocklake.polygonapi.data_loader import PolygonFinancialsDataLoader
Expand Down Expand Up @@ -38,7 +37,7 @@ def test_polygon_financials_store_local_artifact(


def test_polygon_financials_store_postgresql(
SessionLocal, # noqa: F811
SessionLocal,
polygon_financials_data,
):
store = PolygonFinancialsDataStore(SessionLocal)
Expand All @@ -50,7 +49,7 @@ def test_polygon_financials_store_postgresql(

def test_PolygonFinancialsDataSQLAlchemyStore_create(
polygon_financials_data,
SessionLocal, # noqa: F811
SessionLocal,
):
data_length = len(polygon_financials_data)
with SessionLocal() as session, session.begin():
Expand All @@ -72,7 +71,7 @@ def test_PolygonFinancialsDataSQLAlchemyStore_create(

def test_PolygonFinancialsDataSQLAlchemyStore_delete(
polygon_financials_data,
SessionLocal, # noqa: F811
SessionLocal,
):
data_length = len(polygon_financials_data)
with SessionLocal() as session, session.begin():
Expand Down
1 change: 0 additions & 1 deletion tests/stores/db/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import pytest
from click.testing import CliRunner

from conftest import SessionLocal # noqa: F401
from stocklake.core.stdout import PrettyStdoutPrint
from stocklake.stores.db import cli
from stocklake.stores.db.database import database_url
Expand Down

0 comments on commit 3baf777

Please sign in to comment.