Skip to content

Commit

Permalink
Updated all the files
Browse files Browse the repository at this point in the history
  • Loading branch information
vmagueta committed Jul 22, 2024
1 parent 6b8b990 commit cc0a16d
Show file tree
Hide file tree
Showing 26 changed files with 482 additions and 539 deletions.
19 changes: 7 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,28 @@

install:
@echo "Installing for dev environment"
@.venv/bin/python -m pip install -e '.[dev]'
@.venv/bin/python -m pip install -e '.[test,dev]'


virtualenv:
@.venv/bin/python -m pip venv .venv
@python -m venv .venv


ipython:
@.venv/bin/ipython


fmt:
@.venv/bin/isort --profile=black -m 3 dundie tests integration
@.venv/bin/black dundie tests integration


lint:
#@.venv/bin/mypy --ignore-missing-imports dundie
@.venv/bin/pflake8

fmt:
@.venv/bin/isort --profile=black -m 3 dundie tests integration
@.venv/bin/black dundie tests integration

test:
@.venv/bin/pytest -s --forked


watch:
# @.venv/bin/ptw
@ls **/*.py | entr pytest --forked
Expand Down Expand Up @@ -55,14 +53,11 @@ docs:
docs-serve:
@mkdocs serve


build:
@python setup.py sdist bdist_wheel


publish-test:
@twine upload --repository testpypi dist/*


publish:
@twine updload dist/*
@twine upload dist/*
Binary file added assets/database.db
Binary file not shown.
152 changes: 86 additions & 66 deletions assets/database.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,173 +22,193 @@
}
},
"balance": {
"[email protected]": 653,
"[email protected]": 253,
"[email protected]": 200,
"[email protected]": 500
"[email protected]": "658",
"[email protected]": "258",
"[email protected]": "205",
"[email protected]": "505"
},
"movement": {
"[email protected]": [
{
"date": "2024-06-30T13:17:00.085814",
"actor": "system",
"value": 500
"value": "500",
"date": "2024-06-30T13:17:00.085814"
},
{
"date": "2024-07-01T09:38:03.015041",
"actor": "solermvictor",
"value": 30
"value": "30",
"date": "2024-07-01T09:38:03.015041"
},
{
"date": "2024-07-01T09:38:15.965008",
"actor": "solermvictor",
"value": 332
"value": "332",
"date": "2024-07-01T09:38:15.965008"
},
{
"date": "2024-07-01T09:43:45.392936",
"actor": "solermvictor",
"value": -62
"value": "-62",
"date": "2024-07-01T09:43:45.392936"
},
{
"date": "2024-07-01T09:45:45.790470",
"actor": "solermvictor",
"value": 62
"value": "62",
"date": "2024-07-01T09:45:45.790470"
},
{
"date": "2024-07-01T09:45:52.961517",
"actor": "solermvictor",
"value": -62
"value": "-62",
"date": "2024-07-01T09:45:52.961517"
},
{
"date": "2024-07-01T09:47:39.710349",
"actor": "solermvictor",
"value": 5
"value": "5",
"date": "2024-07-01T09:47:39.710349"
},
{
"date": "2024-07-01T09:47:47.852407",
"actor": "solermvictor",
"value": 5
"value": "5",
"date": "2024-07-01T09:47:47.852407"
},
{
"date": "2024-07-01T10:28:44.587618",
"actor": "solermvictor",
"value": -257
"value": "-257",
"date": "2024-07-01T10:28:44.587618"
},
{
"date": "2024-07-01T10:29:00.532653",
"actor": "solermvictor",
"value": 100
"value": "100",
"date": "2024-07-01T10:29:00.532653"
},
{
"date": "2024-07-19T14:41:20.573189",
"actor": "solermvictor",
"value": 5
"value": "5",
"date": "2024-07-19T14:41:20.573189"
},
{
"date": "2024-07-19T14:42:12.498918",
"actor": "solermvictor",
"value": -5
"value": "-5",
"date": "2024-07-19T14:42:12.498918"
},
{
"actor": "solermvictor",
"value": "5",
"date": "2024-07-22T09:53:14.006612"
}
],
"[email protected]": [
{
"date": "2024-06-30T13:17:00.086117",
"actor": "system",
"value": 100
"value": "100",
"date": "2024-06-30T13:17:00.086117"
},
{
"actor": "solermvictor",
"value": "30",
"date": "2024-07-01T09:38:03.015054"
},
{
"date": "2024-07-01T09:38:03.015054",
"actor": "solermvictor",
"value": 30
"value": "332",
"date": "2024-07-01T09:38:15.965025"
},
{
"date": "2024-07-01T09:38:15.965025",
"actor": "solermvictor",
"value": 332
"value": "-62",
"date": "2024-07-01T09:43:45.392949"
},
{
"date": "2024-07-01T09:43:45.392949",
"actor": "solermvictor",
"value": -62
"value": "62",
"date": "2024-07-01T09:45:45.790483"
},
{
"date": "2024-07-01T09:45:45.790483",
"actor": "solermvictor",
"value": 62
"value": "-62",
"date": "2024-07-01T09:45:52.961531"
},
{
"date": "2024-07-01T09:45:52.961531",
"actor": "solermvictor",
"value": -62
"value": "5",
"date": "2024-07-01T09:47:39.710364"
},
{
"date": "2024-07-01T09:47:39.710364",
"actor": "solermvictor",
"value": 5
"value": "5",
"date": "2024-07-01T09:47:47.852421"
},
{
"date": "2024-07-01T09:47:47.852421",
"actor": "solermvictor",
"value": 5
"value": "-257",
"date": "2024-07-01T10:28:44.587632"
},
{
"date": "2024-07-01T10:28:44.587632",
"actor": "solermvictor",
"value": -257
"value": "100",
"date": "2024-07-01T10:29:00.532668"
},
{
"date": "2024-07-01T10:29:00.532668",
"actor": "solermvictor",
"value": 100
"value": "5",
"date": "2024-07-19T14:41:20.573205"
},
{
"date": "2024-07-19T14:41:20.573205",
"actor": "solermvictor",
"value": 5
"value": "-5",
"date": "2024-07-19T14:42:12.498933"
},
{
"date": "2024-07-19T14:42:12.498933",
"actor": "solermvictor",
"value": -5
"value": "5",
"date": "2024-07-22T09:53:14.006660"
}
],
"[email protected]": [
{
"date": "2024-06-30T13:17:00.086294",
"actor": "system",
"value": 100
"value": "100",
"date": "2024-06-30T13:17:00.086294"
},
{
"date": "2024-07-01T10:28:22.353956",
"actor": "solermvictor",
"value": 100
"value": "100",
"date": "2024-07-01T10:28:22.353956"
},
{
"date": "2024-07-19T14:41:20.573209",
"actor": "solermvictor",
"value": 5
"value": "5",
"date": "2024-07-19T14:41:20.573209"
},
{
"date": "2024-07-19T14:42:12.498938",
"actor": "solermvictor",
"value": -5
"value": "-5",
"date": "2024-07-19T14:42:12.498938"
},
{
"actor": "solermvictor",
"value": "5",
"date": "2024-07-22T09:53:14.006692"
}
],
"[email protected]": [
{
"date": "2024-07-15T18:20:06.454769",
"actor": "system",
"value": 500
"value": "500",
"date": "2024-07-15T18:20:06.454769"
},
{
"actor": "solermvictor",
"value": "5",
"date": "2024-07-19T14:41:20.573212"
},
{
"date": "2024-07-19T14:41:20.573212",
"actor": "solermvictor",
"value": 5
"value": "-5",
"date": "2024-07-19T14:42:12.498940"
},
{
"date": "2024-07-19T14:42:12.498940",
"actor": "solermvictor",
"value": -5
"value": "5",
"date": "2024-07-22T09:53:14.006720"
}
]
},
Expand Down
27 changes: 17 additions & 10 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,43 @@
"""Configuration of Pytest for the tests of dundie functions."""

import warnings
import pytest
from unittest.mock import patch
from sqlmodel import create_engine
from dundie import models
from sqlalchemy.exc import SAWarning


warnings.filterwarnings("ignore", category=SAWarning)


MARKER = """\
unit: Mark unit tests
integration: Mark integration tests
high: High priority
medium: Medium priority
low: Low priority
high: High Priority
medium: Medium Priority
low: Low Priority
"""


def pytest_configure(config):
"""Configure the marker for functions."""
for line in MARKER.split("\n"):
config.addinivalue_line("markers", line)


@pytest.fixture(autouse=True)
def go_to_tmpdir(request): # injeção de dependencias
"""Configure to tests run in temporary directory."""
tmpdir = request.getfixturevalue("tmpdir")
with tmpdir.as_cwd():
yield # protocolo de generators


@pytest.fixture(autouse=True, scope="function")
def setup_testing_database(request):
"""For each test, create a db on tmpdir forcing to use that filepath."""
"""For each test, create a database file on tmpdir
force database.py to use that filepath.
"""
tmpdir = request.getfixturevalue("tmpdir")
test_db = str(tmpdir.join("database.test.json"))
with patch("dundie.database.DATABASE_PATH", test_db):
test_db = str(tmpdir.join("database.test.db"))
engine = create_engine(f"sqlite:///{test_db}")
models.SQLModel.metadata.create_all(bind=engine)
with patch("dundie.database.engine", engine):
yield
Loading

0 comments on commit cc0a16d

Please sign in to comment.