Refactored the code for testing and packaging
This commit is contained in:
parent
2c0ca29ed4
commit
4cf96638b8
|
|
@ -5,9 +5,9 @@ name: Python application
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main, test ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main ]
|
branches: [ main, test ]
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 6 * * *'
|
- cron: '0 6 * * *'
|
||||||
|
|
||||||
|
|
@ -16,8 +16,6 @@ jobs:
|
||||||
build:
|
build:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
|
||||||
FIB_INPUT: 10
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
@ -29,13 +27,14 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install flake8 pytest
|
pip install flake8 pytest
|
||||||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
pip install -r requirements_dev.txt
|
||||||
- name: Lint with flake8
|
- name: Lint with flake8
|
||||||
run: |
|
run: |
|
||||||
# stop the build if there are Python syntax errors or undefined names
|
# stop the build if there are Python syntax errors or undefined names
|
||||||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
||||||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
||||||
# - name: Test with pytest
|
- name: Test with pytest
|
||||||
# run: |
|
run: |
|
||||||
# pytest fibtest.py
|
pip install .
|
||||||
|
pytest .
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
[build-system]
|
||||||
|
requires = ["setuptools>=42.0", "wheel"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
|
[tool.pytest.ini_options]
|
||||||
|
addopts = "--cov=bootstraparse"
|
||||||
|
testpaths = [
|
||||||
|
"tests",
|
||||||
|
]
|
||||||
|
|
||||||
|
[tool.mypy]
|
||||||
|
mypy_path = "src"
|
||||||
|
check_untyped_defs = true
|
||||||
|
disallow_any_generics = true
|
||||||
|
ignore_missing_imports = true
|
||||||
|
no_implicit_optional = true
|
||||||
|
show_error_codes = true
|
||||||
|
strict_equality = true
|
||||||
|
warn_redundant_casts = true
|
||||||
|
warn_return_any = true
|
||||||
|
warn_unreachable = true
|
||||||
|
warn_unused_configs = true
|
||||||
|
no_implicit_reexport = true
|
||||||
|
|
@ -1 +1,2 @@
|
||||||
pyyaml==6.0
|
pyyaml==6.0
|
||||||
|
rich~=11.0.0
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
flake8==4.0.1
|
||||||
|
tox==3.24.3
|
||||||
|
pytest==6.2.5
|
||||||
|
pytest-cov==2.12.1
|
||||||
|
mypy===0.910
|
||||||
|
pyyaml==6.0
|
||||||
|
rich~=11.0.0
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
[metadata]
|
||||||
|
name = bootstraparse
|
||||||
|
description = A custom markdown parser for Bootstrap & Python
|
||||||
|
author = Vkyfox
|
||||||
|
license = Mozilla Public License Version 2.0
|
||||||
|
license_file = LICENSE
|
||||||
|
platforms = unix, linux, osx, cygwin, win32
|
||||||
|
classifiers =
|
||||||
|
Programming Language :: Python :: 3
|
||||||
|
Programming Language :: Python :: 3 :: Only
|
||||||
|
Programming Language :: Python :: 3.7
|
||||||
|
Programming Language :: Python :: 3.8
|
||||||
|
Programming Language :: Python :: 3.9
|
||||||
|
|
||||||
|
[options]
|
||||||
|
packages =
|
||||||
|
bootstraparse
|
||||||
|
bootstraparse.modules
|
||||||
|
install_requires =
|
||||||
|
pyyaml>=6.0
|
||||||
|
python_requires = >=3.6
|
||||||
|
package_dir =
|
||||||
|
=src
|
||||||
|
|
||||||
|
zip_safe = no
|
||||||
|
|
||||||
|
[options.packages.find]
|
||||||
|
where =
|
||||||
|
= src
|
||||||
|
= src/bootstraparse
|
||||||
|
|
||||||
|
[options.extras_require]
|
||||||
|
testing =
|
||||||
|
flake8>=4.0.1
|
||||||
|
tox>=3.24.3
|
||||||
|
pytest>=6.2.5
|
||||||
|
pytest-cov>=2.12.1
|
||||||
|
mypy>==0.910
|
||||||
|
pyyaml>=6.0
|
||||||
|
|
||||||
|
[options.package_data]
|
||||||
|
slapping = py.typed
|
||||||
|
|
||||||
|
[flake8]
|
||||||
|
max-line-length = 160
|
||||||
|
|
@ -1 +1,4 @@
|
||||||
# Main program, use this to start parsing
|
# Main program, use this to start parsing
|
||||||
|
|
||||||
|
def totest():
|
||||||
|
print("This is a test")
|
||||||
|
|
@ -32,4 +32,4 @@ class GlobalConfig(ConfigLoader):
|
||||||
super().__init__(configfile)
|
super().__init__(configfile)
|
||||||
|
|
||||||
|
|
||||||
conf = ConfigLoader("./example_userfiles/config/aliases.yml")
|
# conf = ConfigLoader("./example_userfiles/config/aliases.yml")
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
# Module sequencing the successive actions necessary for website building
|
# Module sequencing the successive actions necessary for website building
|
||||||
|
|
||||||
import modules.config as config
|
import bootstraparse.modules.config as config
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def create_website():
|
def create_website():
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
import modules.sitecreator as sitecreator
|
||||||
|
from rich import print, pretty, inspect
|
||||||
|
|
||||||
|
|
||||||
|
pretty.install()
|
||||||
|
|
||||||
|
|
||||||
|
conf = sitecreator.create_config()
|
||||||
|
print("[red]test",conf)
|
||||||
|
inspect(conf)
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
import modules.sitecreator as sitecreator
|
|
||||||
|
|
||||||
|
|
||||||
conf = sitecreator.create_config()
|
|
||||||
print(conf)
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Test the base parser
|
||||||
|
from bootstraparse import bparse
|
||||||
|
|
||||||
|
|
||||||
|
def test_totest():
|
||||||
|
assert bparse.totest() is None
|
||||||
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
[tox]
|
||||||
|
minversion = 3.8.0
|
||||||
|
envlist = py37, py38, py39, flake8, mypy
|
||||||
|
isolated_build = true
|
||||||
|
|
||||||
|
[gh-actions]
|
||||||
|
python =
|
||||||
|
3.7: py36, mypy, flake8
|
||||||
|
3.8: py38
|
||||||
|
3.9: py39
|
||||||
|
|
||||||
|
[testenv]
|
||||||
|
setenv =
|
||||||
|
PYTHONPATH = {toxinidir}
|
||||||
|
deps =
|
||||||
|
-r{toxinidir}/requirements_dev.txt
|
||||||
|
commands =
|
||||||
|
pytest --basetemp={envtmpdir}
|
||||||
|
|
||||||
|
[testenv:flake8]
|
||||||
|
basepython = python3.7
|
||||||
|
deps = flake8
|
||||||
|
commands = flake8 src tests
|
||||||
|
|
||||||
|
[testenv:mypy]
|
||||||
|
basepython = python3.7
|
||||||
|
deps =
|
||||||
|
-r{toxinidir}/requirements_dev.txt
|
||||||
|
commands = mypy src
|
||||||
Loading…
Reference in New Issue