From 2a0312dfa2ae4154c920feeb6009162fbb8ab009 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 15 Dec 2021 14:58:06 +0100 Subject: [PATCH] Begin adding mocking infrastructure --- README.md | 9 +++++++-- noxfile.py | 8 ++++++++ poetry.lock | 20 +++++++++++++++++++- pyproject.toml | 1 + 4 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 noxfile.py diff --git a/README.md b/README.md index 2c0854e..cd83beb 100644 --- a/README.md +++ b/README.md @@ -34,11 +34,16 @@ or move data into Loop Habit Tracker. ## Roadmap * [ ] clean up README -* [ ] begin adding tests - * [ ] add some unit tests for various functions +* [x] begin adding tests + * [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) + * [ ] test most components * [ ] abstract migration target away from loop * [ ] abstract import away from nomie * [ ] abstract importer/migrator themselves to work with other targets * [ ] allow migration to/from nomie/loop +* [ ] cmdline options for + * [ ] ignoring/adding/overwriting duplicated timestamps + * [ ] output file + * [ ] from/to diff --git a/noxfile.py b/noxfile.py new file mode 100644 index 0000000..082ac78 --- /dev/null +++ b/noxfile.py @@ -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 diff --git a/poetry.lock b/poetry.lock index 015f3c1..e446fb1 100644 --- a/poetry.lock +++ b/poetry.lock @@ -139,6 +139,20 @@ pytest = ">=4.6" [package.extras] 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]] name = "toml" version = "0.10.2" @@ -158,7 +172,7 @@ python-versions = ">=3.6" [metadata] lock-version = "1.1" python-versions = "^3.9" -content-hash = "47104052627c5737e341ecfb58eb57c259f5baf5c99d7251dc860b331e18bee0" +content-hash = "3018d9e058177fcc4d085739d8dad7a04716ccf3a0e87a22e148960a146ca85b" [metadata.files] atomicwrites = [ @@ -254,6 +268,10 @@ pytest-cov = [ {file = "pytest-cov-3.0.0.tar.gz", hash = "sha256:e7f0f5b1617d2210a2cabc266dfe2f4c75a8d32fb89eafb7ad9d06f6d076d470"}, {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 = [ {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, diff --git a/pyproject.toml b/pyproject.toml index ea66bf7..fa14e83 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,6 +16,7 @@ click = "^8.0" pytest = "^6.2" coverage = {extras = ["toml"], version = "^6.2"} pytest-cov = "^3.0.0" +pytest-mock = "^3.6.1" [tool.poetry.scripts] habitmove = "habitmove.cli:main"