Begin adding mocking infrastructure

This commit is contained in:
Marty Oehme 2021-12-15 14:58:06 +01:00
parent b9c89155e3
commit 2a0312dfa2
Signed by: Marty
GPG key ID: B7538B8F50A1C800
4 changed files with 35 additions and 3 deletions

View file

@ -34,11 +34,16 @@ or move data into Loop Habit Tracker.
## Roadmap ## Roadmap
* [ ] clean up README * [ ] clean up README
* [ ] begin adding tests * [x] begin adding tests
* [ ] add some unit tests for various functions * [x] add some unit tests for various functions
* [ ] and at least an integration test for the stable database (loop-2021-12-02.db or equivalent) * [ ] and at least an integration test for the stable database (loop-2021-12-02.db or equivalent)
* [ ] test most components
* [ ] abstract migration target away from loop * [ ] abstract migration target away from loop
* [ ] abstract import away from nomie * [ ] abstract import away from nomie
* [ ] abstract importer/migrator themselves to work with other targets * [ ] abstract importer/migrator themselves to work with other targets
* [ ] allow migration to/from nomie/loop * [ ] allow migration to/from nomie/loop
* [ ] cmdline options for
* [ ] ignoring/adding/overwriting duplicated timestamps
* [ ] output file
* [ ] from/to

8
noxfile.py Normal file
View file

@ -0,0 +1,8 @@
import nox
@nox.session(python=["3.7", "3.8", "3.9"])
def tests(session):
session.run("poetry", "install", external=True)
session.run("pytest", "--cov")
pass

20
poetry.lock generated
View file

@ -139,6 +139,20 @@ pytest = ">=4.6"
[package.extras] [package.extras]
testing = ["fields", "hunter", "process-tests", "six", "pytest-xdist", "virtualenv"] testing = ["fields", "hunter", "process-tests", "six", "pytest-xdist", "virtualenv"]
[[package]]
name = "pytest-mock"
version = "3.6.1"
description = "Thin-wrapper around the mock package for easier use with pytest"
category = "dev"
optional = false
python-versions = ">=3.6"
[package.dependencies]
pytest = ">=5.0"
[package.extras]
dev = ["pre-commit", "tox", "pytest-asyncio"]
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.10.2" version = "0.10.2"
@ -158,7 +172,7 @@ python-versions = ">=3.6"
[metadata] [metadata]
lock-version = "1.1" lock-version = "1.1"
python-versions = "^3.9" python-versions = "^3.9"
content-hash = "47104052627c5737e341ecfb58eb57c259f5baf5c99d7251dc860b331e18bee0" content-hash = "3018d9e058177fcc4d085739d8dad7a04716ccf3a0e87a22e148960a146ca85b"
[metadata.files] [metadata.files]
atomicwrites = [ atomicwrites = [
@ -254,6 +268,10 @@ pytest-cov = [
{file = "pytest-cov-3.0.0.tar.gz", hash = "sha256:e7f0f5b1617d2210a2cabc266dfe2f4c75a8d32fb89eafb7ad9d06f6d076d470"}, {file = "pytest-cov-3.0.0.tar.gz", hash = "sha256:e7f0f5b1617d2210a2cabc266dfe2f4c75a8d32fb89eafb7ad9d06f6d076d470"},
{file = "pytest_cov-3.0.0-py3-none-any.whl", hash = "sha256:578d5d15ac4a25e5f961c938b85a05b09fdaae9deef3bb6de9a6e766622ca7a6"}, {file = "pytest_cov-3.0.0-py3-none-any.whl", hash = "sha256:578d5d15ac4a25e5f961c938b85a05b09fdaae9deef3bb6de9a6e766622ca7a6"},
] ]
pytest-mock = [
{file = "pytest-mock-3.6.1.tar.gz", hash = "sha256:40217a058c52a63f1042f0784f62009e976ba824c418cced42e88d5f40ab0e62"},
{file = "pytest_mock-3.6.1-py3-none-any.whl", hash = "sha256:30c2f2cc9759e76eee674b81ea28c9f0b94f8f0445a1b87762cadf774f0df7e3"},
]
toml = [ toml = [
{file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"},
{file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"},

View file

@ -16,6 +16,7 @@ click = "^8.0"
pytest = "^6.2" pytest = "^6.2"
coverage = {extras = ["toml"], version = "^6.2"} coverage = {extras = ["toml"], version = "^6.2"}
pytest-cov = "^3.0.0" pytest-cov = "^3.0.0"
pytest-mock = "^3.6.1"
[tool.poetry.scripts] [tool.poetry.scripts]
habitmove = "habitmove.cli:main" habitmove = "habitmove.cli:main"