Skip to content

Commit 5183cf6

Browse files
committed
fix all the imports, get it all working
1 parent 810d76e commit 5183cf6

14 files changed

Lines changed: 30 additions & 28 deletions

File tree

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ services:
1111
- DB_HOST=postgres
1212
- DB_PASSWORD=abc123
1313
volumes:
14-
- ./:/code
14+
- ./src:/src
1515
ports:
1616
- "5005:80"
1717

mypy.ini

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
[mypy]
22
ignore_missing_imports = False
3+
mypy_path = ./src
34

4-
[mypy-pytest.*]
5+
[mypy-pytest.*,sqlalchemy.*]
56
ignore_missing_imports = True
6-
7-
[mypy-sqlalchemy.*]
8-
ignore_missing_imports = True
9-

src/allocation/adapters/orm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
)
55
from sqlalchemy.orm import mapper, relationship
66

7-
from domain import model
7+
from allocation.domain import model
88

99

1010
metadata = MetaData()

src/allocation/adapters/repository.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import abc
2-
from domain import model
2+
from allocation.domain import model
33

44

55
class AbstractRepository(abc.ABC):

src/allocation/entrypoints/flask_app.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
from sqlalchemy import create_engine
44
from sqlalchemy.orm import sessionmaker
55

6-
import config
7-
from domain import model
8-
from adapters import orm, repository
9-
from service_layer import services
6+
from allocation import config
7+
from allocation.domain import model
8+
from allocation.adapters import orm, repository
9+
from allocation.service_layer import services
1010

1111
orm.start_mappers()
1212
get_session = sessionmaker(bind=create_engine(config.get_postgres_uri()))

src/allocation/service_layer/services.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
from typing import Optional
33
from datetime import date
44

5-
from domain import model
6-
from domain.model import OrderLine
7-
from adapters.repository import AbstractRepository
5+
from allocation.domain import model
6+
from allocation.domain.model import OrderLine
7+
from allocation.adapters.repository import AbstractRepository
88

99
class InvalidSku(Exception):
1010
pass

tests/conftest.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
from sqlalchemy import create_engine
1010
from sqlalchemy.orm import sessionmaker, clear_mappers
1111

12-
from adapters.orm import metadata, start_mappers
13-
import config
12+
from allocation.adapters.orm import metadata, start_mappers
13+
from allocation import config
1414

1515

1616
@pytest.fixture
@@ -66,7 +66,6 @@ def postgres_session(postgres_db):
6666

6767
@pytest.fixture
6868
def restart_api():
69-
(Path(__file__).parent / '../entrypoints/flask_app.py').touch()
69+
(Path(__file__).parent / '../src/allocation/entrypoints/flask_app.py').touch()
7070
time.sleep(0.5)
7171
wait_for_webapp_to_come_up()
72-

tests/e2e/test_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import pytest
33
import requests
44

5-
import config
5+
from allocation import config
66

77
def random_suffix():
88
return uuid.uuid4().hex[:6]

tests/integration/test_orm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from domain import model
1+
from allocation.domain import model
22
from datetime import date
33

44
def test_orderline_mapper_can_load_lines(session):

tests/integration/test_repository.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pylint: disable=protected-access
2-
from domain import model
3-
from adapters import repository
2+
from allocation.domain import model
3+
from allocation.adapters import repository
44

55
def test_repository_can_save_a_batch(session):
66
batch = model.Batch("batch1", "RUSTY-SOAPDISH", 100, eta=None)

0 commit comments

Comments
 (0)