Merge pull request #46 from b2m/tool-changes

Tool changes
pull/49/head
Mike Gerber 4 years ago committed by GitHub
commit fed021090d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
[run]
omit = qurator/dinglehopper/tests/*

@ -7,7 +7,7 @@ indent_size = 4
indent_style = space indent_style = space
insert_final_newline = true insert_final_newline = true
trim_trailing_whitespace = true trim_trailing_whitespace = true
max_line_length = 90 max_line_length = 88
tab_width = 4 tab_width = 4
[{*.cfg, *.ini, *.html, *.yaml, *.yml}] [{*.cfg, *.ini, *.html, *.yaml, *.yml}]
@ -20,3 +20,10 @@ insert_final_newline = false
# trailing spaces in markdown indicate word wrap # trailing spaces in markdown indicate word wrap
[*.md] [*.md]
trim_trailing_whitespace = false trim_trailing_whitespace = false
[*.py]
multi_line_output = 3
include_trailing_comma = True
force_grid_wrap = 0
use_parentheses = True
ensure_newline_before_comments = True

33
.gitignore vendored

@ -1,25 +1,26 @@
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files
__pycache__/ __pycache__/
*.py[cod] *.py[cod]
*$py.class
# Distribution / packaging # Distribution / packaging
*.egg-info/ *.egg-info/
# User-specific stuff # Unit test / coverage reports
.idea/**/workspace.xml htmlcov/
.idea/**/tasks.xml .coverage
.idea/**/usage.statistics.xml .coverage.*
.idea/**/dictionaries
.idea/**/shelf # Environments
.env
.venv
env/
venv/
# Generated files # mypy
.idea/**/contentModel.xml .mypy_cache/
.dmypy.json
dmypy.json
# Sensitive or high-churn files # User-specific stuff
.idea/**/dataSources/ .idea
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.7 (dinglehopper-github)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="pytest" />
</component>
</module>

@ -1,6 +0,0 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (dinglehopper-github)" project-jdk-type="Python SDK" />
</project>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/dinglehopper.iml" filepath="$PROJECT_DIR$/.idea/dinglehopper.iml" />
</modules>
</component>
</project>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

@ -1,10 +1,37 @@
Testing # Testing
-------
Use `pytest` to run the tests in [the tests directory](qurator/dinglehopper/tests): Use `pytest` to run the tests in [the tests directory](qurator/dinglehopper/tests):
~~~ ```bash
virtualenv -p /usr/bin/python3 venv virtualenv -p /usr/bin/python3 venv
. venv/bin/activate . venv/bin/activate
pip install -r requirements.txt pip install -r requirements.txt
pip install pytest pip install -r requirements-dev.txt
pytest pytest
~~~ ```
### Test running examples
### Only unit tests
```bash
pytest -m "not integration"
```
### Only integration tests
```bash
pytest -m integration
```
### All tests
```bash
pytest
```
### All tests with code coverage
```bash
pytest --cov=qurator --cov-report=html
```
### Static code analysis
```bash
pytest -k "not test" --flake8
pytest -k "not test" --mypy
```

@ -1,6 +0,0 @@
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.7 (dinglehopper)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TestRunnerService">
<option name="projectConfiguration" value="pytest" />
<option name="PROJECT_TEST_RUNNER" value="pytest" />
</component>
</module>

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (dinglehopper)" project-jdk-type="Python SDK" />
<component name="PyCharmProfessionalAdvertiser">
<option name="shown" value="true" />
</component>
</project>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/dinglehopper.iml" filepath="$PROJECT_DIR$/.idea/dinglehopper.iml" />
</modules>
</component>
</project>

@ -4,6 +4,7 @@ import json
import sys import sys
from pathlib import Path from pathlib import Path
import pytest
from click.testing import CliRunner from click.testing import CliRunner
from .util import working_directory from .util import working_directory
@ -13,6 +14,7 @@ from ..ocrd_cli import ocrd_dinglehopper
data_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data") data_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data")
@pytest.mark.skipif(sys.platform == 'win32', reason="only on unix")
def test_ocrd_cli(tmp_path): def test_ocrd_cli(tmp_path):
"""Test OCR-D interface""" """Test OCR-D interface"""

@ -0,0 +1,5 @@
pytest
pytest-flake8
pytest-cov
pytest-mypy
black

@ -1,2 +1,12 @@
[flake8] [flake8]
max-line-length = 90 max-line-length = 88
extend-ignore = E203, W503
[pylint]
max-line-length = 88
[pylint.messages_control]
disable = C0330, C0326
[mypy]
ignore_missing_imports = True

@ -4,6 +4,9 @@ from setuptools import find_packages, setup
with open("requirements.txt") as fp: with open("requirements.txt") as fp:
install_requires = fp.read() install_requires = fp.read()
with open('requirements-dev.txt') as fp:
tests_require = fp.read()
setup( setup(
name="dinglehopper", name="dinglehopper",
author="Mike Gerber, The QURATOR SPK Team", author="Mike Gerber, The QURATOR SPK Team",
@ -16,6 +19,7 @@ setup(
namespace_packages=["qurator"], namespace_packages=["qurator"],
packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]), packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
install_requires=install_requires, install_requires=install_requires,
tests_require=tests_require,
package_data={ package_data={
"": ["*.json", "templates/*"], "": ["*.json", "templates/*"],
}, },

Loading…
Cancel
Save