From 047c200d7d81e20724e26ab9ca07e746f019be84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D1=82=D0=BE=D0=BD=20=D0=9A=D0=B0=D1=81=D0=B8?= =?UTF-8?q?=D0=BC=D0=BE=D0=B2?= Date: Sun, 10 Feb 2019 23:21:47 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2=20?= =?UTF-8?q?=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B5=D1=85=D0=BE=D0=B4=20=D0=BD?= =?UTF-8?q?=D0=B0=200.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .hgignore | 1 + Makefile | 5 ++++- pytest.ini | 3 +++ setup.py | 2 +- tests/pages/index.md | 7 +++++++ tests/test_pages.py | 16 ++++++++++++++++ 6 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 pytest.ini create mode 100644 tests/pages/index.md create mode 100644 tests/test_pages.py diff --git a/.hgignore b/.hgignore index 7abd490..0222ec8 100644 --- a/.hgignore +++ b/.hgignore @@ -39,6 +39,7 @@ pip-log.txt .coverage .tox nosetests.xml +.pytest_cache # Translations *.mo diff --git a/Makefile b/Makefile index c052994..cca54e2 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,7 @@ -all: bdist +all: test bdist bdist: python3 setup.py sdist bdist_wheel + +test: + pytest -q diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..18522a6 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,3 @@ +[pytest] +testpaths = tests +python_files = test*.py diff --git a/setup.py b/setup.py index 43546cc..7471035 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ tests_require = [ setup( name='flatfilecms', - version='0.2', + version='0.3', description='flat-file CMS suitable for static site', long_description=README + '\n\n' + CHANGES, classifiers=[ diff --git a/tests/pages/index.md b/tests/pages/index.md new file mode 100644 index 0000000..5466d95 --- /dev/null +++ b/tests/pages/index.md @@ -0,0 +1,7 @@ +--- +title: Заглушка для тестов БД +description: Тестовая страница +template: onepage +--- + +Hello World! diff --git a/tests/test_pages.py b/tests/test_pages.py new file mode 100644 index 0000000..82d09d3 --- /dev/null +++ b/tests/test_pages.py @@ -0,0 +1,16 @@ +import pytest + + +@pytest.fixture +def pages(): + from flatfilecms.resources import Root + return Root('../tests/pages') + + +def test_loading(pages): + assert 'index' in pages + + +def test_db_contains_pages(pages): + assert pages['index'].title == 'Заглушка для тестов БД' + pass