Test cobertura mypy coverage report
This commit is contained in:
parent
180d73f9c4
commit
5232b36644
5 changed files with 71 additions and 12 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -71,3 +71,4 @@ activate
|
||||||
# UML diagrams
|
# UML diagrams
|
||||||
classes.png
|
classes.png
|
||||||
packages.png
|
packages.png
|
||||||
|
openflexure_microscope/cobertura.xml
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,10 @@ mypy:
|
||||||
script:
|
script:
|
||||||
- poetry run poe mypy
|
- poetry run poe mypy
|
||||||
|
|
||||||
|
artifacts:
|
||||||
|
reports:
|
||||||
|
cobertura: openflexure_microscope/cobertura.xml
|
||||||
|
|
||||||
only:
|
only:
|
||||||
- branches
|
- branches
|
||||||
- merge_requests
|
- merge_requests
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ else:
|
||||||
|
|
||||||
|
|
||||||
# Set root logger level
|
# Set root logger level
|
||||||
root_log = logging.getLogger()
|
root_log: logging.Logger = logging.getLogger()
|
||||||
root_log.setLevel(log_level)
|
root_log.setLevel(log_level)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -58,25 +58,25 @@ class CustomRotatingFileHandler(logging.handlers.RotatingFileHandler):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
# Never propagate
|
# Never propagate
|
||||||
self.propagate = False
|
self.propagate: bool = False
|
||||||
# Conditionally enable debugging
|
# Conditionally enable debugging
|
||||||
if debug:
|
if debug:
|
||||||
self.setLevel(logging.DEBUG)
|
self.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
# Log files
|
# Log files
|
||||||
ROOT_LOGFILE = logs_file_path("openflexure_microscope.log")
|
ROOT_LOGFILE: str = logs_file_path("openflexure_microscope.log")
|
||||||
ACCESS_LOGFILE = logs_file_path("openflexure_microscope.access.log")
|
ACCESS_LOGFILE: str = logs_file_path("openflexure_microscope.access.log")
|
||||||
|
|
||||||
# Our WSGI server uses Werkzeug, so use that for the access log
|
# Our WSGI server uses Werkzeug, so use that for the access log
|
||||||
access_log = logging.getLogger("werkzeug")
|
access_log: logging.Logger = logging.getLogger("werkzeug")
|
||||||
# Block the access logs from propagating up to the root logger
|
# Block the access logs from propagating up to the root logger
|
||||||
access_log.propagate = False
|
access_log.propagate = False
|
||||||
|
|
||||||
# Create error log file handler
|
# Create error log file handler
|
||||||
fh = CustomRotatingFileHandler(ROOT_LOGFILE, debug=debug_app)
|
fh: logging.Handler = CustomRotatingFileHandler(ROOT_LOGFILE, debug=debug_app)
|
||||||
# Create access log file handler
|
# Create access log file handler
|
||||||
afh = CustomRotatingFileHandler(ACCESS_LOGFILE, debug=debug_app)
|
afh: logging.Handler = CustomRotatingFileHandler(ACCESS_LOGFILE, debug=debug_app)
|
||||||
# Add file handler to root logger
|
# Add file handler to root logger
|
||||||
root_log.addHandler(fh)
|
root_log.addHandler(fh)
|
||||||
access_log.addHandler(afh)
|
access_log.addHandler(afh)
|
||||||
|
|
@ -85,7 +85,7 @@ access_log.addHandler(afh)
|
||||||
logging.info("Running with data path %s", OPENFLEXURE_VAR_PATH)
|
logging.info("Running with data path %s", OPENFLEXURE_VAR_PATH)
|
||||||
|
|
||||||
# Create the microscope object
|
# Create the microscope object
|
||||||
api_microscope = Microscope()
|
api_microscope: Microscope = Microscope()
|
||||||
logging.debug("Restoring captures...")
|
logging.debug("Restoring captures...")
|
||||||
api_microscope.captures.rebuild_captures()
|
api_microscope.captures.rebuild_captures()
|
||||||
logging.debug("Microscope successfully attached!")
|
logging.debug("Microscope successfully attached!")
|
||||||
|
|
@ -103,7 +103,7 @@ app, labthing = create_app(
|
||||||
)
|
)
|
||||||
|
|
||||||
# Enable CORS for some routes outside of LabThings
|
# Enable CORS for some routes outside of LabThings
|
||||||
cors = CORS(app)
|
cors: CORS = CORS(app)
|
||||||
|
|
||||||
# Use custom JSON encoder
|
# Use custom JSON encoder
|
||||||
labthing.json_encoder = JSONEncoder
|
labthing.json_encoder = JSONEncoder
|
||||||
|
|
@ -223,5 +223,5 @@ if __name__ == "__main__":
|
||||||
from labthings import Server
|
from labthings import Server
|
||||||
|
|
||||||
logging.info("Starting OpenFlexure Microscope Server...")
|
logging.info("Starting OpenFlexure Microscope Server...")
|
||||||
server = Server(app)
|
server: Server = Server(app)
|
||||||
server.run(host="0.0.0.0", port=5000, debug=debug_app, zeroconf=True)
|
server.run(host="0.0.0.0", port=5000, debug=debug_app, zeroconf=True)
|
||||||
|
|
|
||||||
55
poetry.lock
generated
55
poetry.lock
generated
|
|
@ -360,6 +360,20 @@ category = "dev"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lxml"
|
||||||
|
version = "4.6.2"
|
||||||
|
description = "Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API."
|
||||||
|
category = "dev"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, != 3.4.*"
|
||||||
|
|
||||||
|
[package.extras]
|
||||||
|
cssselect = ["cssselect (>=0.7)"]
|
||||||
|
html5 = ["html5lib"]
|
||||||
|
htmlsoup = ["beautifulsoup4"]
|
||||||
|
source = ["Cython (>=0.29.7)"]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "markupsafe"
|
name = "markupsafe"
|
||||||
version = "1.1.1"
|
version = "1.1.1"
|
||||||
|
|
@ -967,7 +981,7 @@ rpi = ["RPi.GPIO"]
|
||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "1.1"
|
lock-version = "1.1"
|
||||||
python-versions = "^3.7.3"
|
python-versions = "^3.7.3"
|
||||||
content-hash = "6a765bc080ad5f6eade8525043e32efcaf25e4e64ebdc32ada3ab4a923b7d03d"
|
content-hash = "57a3c3fcab4e72f4ff6f37b461967e9c60903baa9f879842c93305069165513c"
|
||||||
|
|
||||||
[metadata.files]
|
[metadata.files]
|
||||||
alabaster = [
|
alabaster = [
|
||||||
|
|
@ -1162,6 +1176,45 @@ lazy-object-proxy = [
|
||||||
{file = "lazy_object_proxy-1.4.3-cp38-cp38-win32.whl", hash = "sha256:5541cada25cd173702dbd99f8e22434105456314462326f06dba3e180f203dfd"},
|
{file = "lazy_object_proxy-1.4.3-cp38-cp38-win32.whl", hash = "sha256:5541cada25cd173702dbd99f8e22434105456314462326f06dba3e180f203dfd"},
|
||||||
{file = "lazy_object_proxy-1.4.3-cp38-cp38-win_amd64.whl", hash = "sha256:59f79fef100b09564bc2df42ea2d8d21a64fdcda64979c0fa3db7bdaabaf6239"},
|
{file = "lazy_object_proxy-1.4.3-cp38-cp38-win_amd64.whl", hash = "sha256:59f79fef100b09564bc2df42ea2d8d21a64fdcda64979c0fa3db7bdaabaf6239"},
|
||||||
]
|
]
|
||||||
|
lxml = [
|
||||||
|
{file = "lxml-4.6.2-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:a9d6bc8642e2c67db33f1247a77c53476f3a166e09067c0474facb045756087f"},
|
||||||
|
{file = "lxml-4.6.2-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:791394449e98243839fa822a637177dd42a95f4883ad3dec2a0ce6ac99fb0a9d"},
|
||||||
|
{file = "lxml-4.6.2-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:68a5d77e440df94011214b7db907ec8f19e439507a70c958f750c18d88f995d2"},
|
||||||
|
{file = "lxml-4.6.2-cp27-cp27m-win32.whl", hash = "sha256:fc37870d6716b137e80d19241d0e2cff7a7643b925dfa49b4c8ebd1295eb506e"},
|
||||||
|
{file = "lxml-4.6.2-cp27-cp27m-win_amd64.whl", hash = "sha256:69a63f83e88138ab7642d8f61418cf3180a4d8cd13995df87725cb8b893e950e"},
|
||||||
|
{file = "lxml-4.6.2-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:42ebca24ba2a21065fb546f3e6bd0c58c3fe9ac298f3a320147029a4850f51a2"},
|
||||||
|
{file = "lxml-4.6.2-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:f83d281bb2a6217cd806f4cf0ddded436790e66f393e124dfe9731f6b3fb9afe"},
|
||||||
|
{file = "lxml-4.6.2-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:535f067002b0fd1a4e5296a8f1bf88193080ff992a195e66964ef2a6cfec5388"},
|
||||||
|
{file = "lxml-4.6.2-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:366cb750140f221523fa062d641393092813b81e15d0e25d9f7c6025f910ee80"},
|
||||||
|
{file = "lxml-4.6.2-cp35-cp35m-manylinux2014_aarch64.whl", hash = "sha256:97db258793d193c7b62d4e2586c6ed98d51086e93f9a3af2b2034af01450a74b"},
|
||||||
|
{file = "lxml-4.6.2-cp35-cp35m-win32.whl", hash = "sha256:648914abafe67f11be7d93c1a546068f8eff3c5fa938e1f94509e4a5d682b2d8"},
|
||||||
|
{file = "lxml-4.6.2-cp35-cp35m-win_amd64.whl", hash = "sha256:4e751e77006da34643ab782e4a5cc21ea7b755551db202bc4d3a423b307db780"},
|
||||||
|
{file = "lxml-4.6.2-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:681d75e1a38a69f1e64ab82fe4b1ed3fd758717bed735fb9aeaa124143f051af"},
|
||||||
|
{file = "lxml-4.6.2-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:127f76864468d6630e1b453d3ffbbd04b024c674f55cf0a30dc2595137892d37"},
|
||||||
|
{file = "lxml-4.6.2-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:4fb85c447e288df535b17ebdebf0ec1cf3a3f1a8eba7e79169f4f37af43c6b98"},
|
||||||
|
{file = "lxml-4.6.2-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:5be4a2e212bb6aa045e37f7d48e3e1e4b6fd259882ed5a00786f82e8c37ce77d"},
|
||||||
|
{file = "lxml-4.6.2-cp36-cp36m-win32.whl", hash = "sha256:8c88b599e226994ad4db29d93bc149aa1aff3dc3a4355dd5757569ba78632bdf"},
|
||||||
|
{file = "lxml-4.6.2-cp36-cp36m-win_amd64.whl", hash = "sha256:6e4183800f16f3679076dfa8abf2db3083919d7e30764a069fb66b2b9eff9939"},
|
||||||
|
{file = "lxml-4.6.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:d8d3d4713f0c28bdc6c806a278d998546e8efc3498949e3ace6e117462ac0a5e"},
|
||||||
|
{file = "lxml-4.6.2-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:8246f30ca34dc712ab07e51dc34fea883c00b7ccb0e614651e49da2c49a30711"},
|
||||||
|
{file = "lxml-4.6.2-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:923963e989ffbceaa210ac37afc9b906acebe945d2723e9679b643513837b089"},
|
||||||
|
{file = "lxml-4.6.2-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:1471cee35eba321827d7d53d104e7b8c593ea3ad376aa2df89533ce8e1b24a01"},
|
||||||
|
{file = "lxml-4.6.2-cp37-cp37m-win32.whl", hash = "sha256:2363c35637d2d9d6f26f60a208819e7eafc4305ce39dc1d5005eccc4593331c2"},
|
||||||
|
{file = "lxml-4.6.2-cp37-cp37m-win_amd64.whl", hash = "sha256:f4822c0660c3754f1a41a655e37cb4dbbc9be3d35b125a37fab6f82d47674ebc"},
|
||||||
|
{file = "lxml-4.6.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:0448576c148c129594d890265b1a83b9cd76fd1f0a6a04620753d9a6bcfd0a4d"},
|
||||||
|
{file = "lxml-4.6.2-cp38-cp38-manylinux1_i686.whl", hash = "sha256:60a20bfc3bd234d54d49c388950195d23a5583d4108e1a1d47c9eef8d8c042b3"},
|
||||||
|
{file = "lxml-4.6.2-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:2e5cc908fe43fe1aa299e58046ad66981131a66aea3129aac7770c37f590a644"},
|
||||||
|
{file = "lxml-4.6.2-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:50c348995b47b5a4e330362cf39fc503b4a43b14a91c34c83b955e1805c8e308"},
|
||||||
|
{file = "lxml-4.6.2-cp38-cp38-win32.whl", hash = "sha256:94d55bd03d8671686e3f012577d9caa5421a07286dd351dfef64791cf7c6c505"},
|
||||||
|
{file = "lxml-4.6.2-cp38-cp38-win_amd64.whl", hash = "sha256:7a7669ff50f41225ca5d6ee0a1ec8413f3a0d8aa2b109f86d540887b7ec0d72a"},
|
||||||
|
{file = "lxml-4.6.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:e0bfe9bb028974a481410432dbe1b182e8191d5d40382e5b8ff39cdd2e5c5931"},
|
||||||
|
{file = "lxml-4.6.2-cp39-cp39-manylinux1_i686.whl", hash = "sha256:6fd8d5903c2e53f49e99359b063df27fdf7acb89a52b6a12494208bf61345a03"},
|
||||||
|
{file = "lxml-4.6.2-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:7e9eac1e526386df7c70ef253b792a0a12dd86d833b1d329e038c7a235dfceb5"},
|
||||||
|
{file = "lxml-4.6.2-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:7ee8af0b9f7de635c61cdd5b8534b76c52cd03536f29f51151b377f76e214a1a"},
|
||||||
|
{file = "lxml-4.6.2-cp39-cp39-win32.whl", hash = "sha256:2e6fd1b8acd005bd71e6c94f30c055594bbd0aa02ef51a22bbfa961ab63b2d75"},
|
||||||
|
{file = "lxml-4.6.2-cp39-cp39-win_amd64.whl", hash = "sha256:535332fe9d00c3cd455bd3dd7d4bacab86e2d564bdf7606079160fa6251caacf"},
|
||||||
|
{file = "lxml-4.6.2.tar.gz", hash = "sha256:cd11c7e8d21af997ee8079037fff88f16fda188a9776eb4b81c7e4c9c0a7d7fc"},
|
||||||
|
]
|
||||||
markupsafe = [
|
markupsafe = [
|
||||||
{file = "MarkupSafe-1.1.1-cp27-cp27m-macosx_10_6_intel.whl", hash = "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161"},
|
{file = "MarkupSafe-1.1.1-cp27-cp27m-macosx_10_6_intel.whl", hash = "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161"},
|
||||||
{file = "MarkupSafe-1.1.1-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7"},
|
{file = "MarkupSafe-1.1.1-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7"},
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ pytest = "^6.1.2"
|
||||||
mypy = "^0.790"
|
mypy = "^0.790"
|
||||||
poethepoet = "^0.9.0"
|
poethepoet = "^0.9.0"
|
||||||
freezegun = "^1.0.0"
|
freezegun = "^1.0.0"
|
||||||
|
lxml = "^4.6.2"
|
||||||
|
|
||||||
[tool.black]
|
[tool.black]
|
||||||
exclude = '(\.eggs|\.git|\.venv|\venv|node_modules/)'
|
exclude = '(\.eggs|\.git|\.venv|\venv|node_modules/)'
|
||||||
|
|
@ -86,7 +87,7 @@ black = "black ."
|
||||||
black_check = "black --check ."
|
black_check = "black --check ."
|
||||||
isort = "isort ."
|
isort = "isort ."
|
||||||
pylint = "pylint openflexure_microscope"
|
pylint = "pylint openflexure_microscope"
|
||||||
mypy = "mypy openflexure_microscope"
|
mypy = "mypy --cobertura-xml-report openflexure_microscope openflexure_microscope"
|
||||||
test = "pytest ."
|
test = "pytest ."
|
||||||
|
|
||||||
format = ["black", "isort"]
|
format = ["black", "isort"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue