relocating environment yml to the project root, creating an import_modules test for every single dependency to ensure proper setup & versioning at all times. Creating a test, which creates the flask app. Updating gitignore slightly to remove egg-info files, which are created upon installing a library with pip
This commit is contained in:
parent
9e7ded1ef2
commit
a25c786b3c
4
.gitignore
vendored
4
.gitignore
vendored
@ -435,8 +435,8 @@ FodyWeavers.xsd
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Local change logs
|
||||
# Local change logs, egg-infos from package installation and local notebooks for development and interactive work
|
||||
change_log_metz.md
|
||||
src/notebooks_metz
|
||||
src/lib_brecal_utils/**.egg-info
|
||||
**.egg-info
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ name: brecal
|
||||
|
||||
channels:
|
||||
- conda-forge
|
||||
- carta
|
||||
- anaconda
|
||||
- defaults
|
||||
|
||||
@ -25,10 +26,24 @@ dependencies:
|
||||
- typing_extensions>=4.7.1=pyha770c72_0
|
||||
- typing_utils>=0.1.0=pyhd8ed1ab_0
|
||||
- conda-forge::pandas>=2.1.0=py311h320fe9a_0
|
||||
- conda-forge::opencv>=4.7.0=py311h38be061_1
|
||||
|
||||
- conda-forge/noarch::flask>=2.3.3=pyhd8ed1ab_0
|
||||
- conda-forge::mysql-connector-python>=8.0.31=py311h0cf059c_2
|
||||
- conda-forge::marshmallow>=3.20.1=pyhd8ed1ab_0
|
||||
- conda-forge::marshmallow-dataclass>=8.5.14=pyhd8ed1ab_0
|
||||
- conda-forge::webargs>=8.3.0=pyhd8ed1ab_0
|
||||
- conda-forge::bcrypt>=4.0.1=py311h46250e7_0
|
||||
|
||||
- conda-forge::cached-property>=1.5.2=hd8ed1ab_1
|
||||
- conda-forge::cached_property>=1.5.2=pyha770c72_1
|
||||
- conda-forge::dsnparse>=0.2.1=pyhd8ed1ab_0
|
||||
|
||||
- pip:
|
||||
# pip packages and wheels
|
||||
- pyjwt==2.7.0
|
||||
- flask-jwt-extended
|
||||
- pydapper[mysql-connector-python]
|
||||
- coro-context-manager
|
||||
- -e /home/scope/brecal/src/lib_brecal_utils/.
|
||||
- -e /home/scope/brecal/src/server/.
|
||||
|
||||
prefix: /home/scope/anaconda3/envs/brecal
|
||||
@ -1 +1,11 @@
|
||||
from ._version import __version__
|
||||
from brecal_utils.file_handling import get_project_root, ensure_path
|
||||
from brecal_utils.test_handling import execute_test_with_pytest, execute_coverage_test
|
||||
|
||||
__all__ = [
|
||||
"get_project_root",
|
||||
"ensure_path",
|
||||
"execute_test_with_pytest",
|
||||
"execute_coverage_test",
|
||||
]
|
||||
|
||||
|
||||
89
src/lib_brecal_utils/tests/test_import_modules.py
Normal file
89
src/lib_brecal_utils/tests/test_import_modules.py
Normal file
@ -0,0 +1,89 @@
|
||||
import pytest
|
||||
|
||||
def test_import_colorama():
|
||||
"""
|
||||
colorama is used for 'pretty print' options, such as colored printing. For example, this is used in pytest-cov to quickly
|
||||
highlight passing and failing tests
|
||||
"""
|
||||
import colorama
|
||||
return
|
||||
|
||||
def test_import_matplotlib():
|
||||
"""matplotlib is used for visualizations (e.g. images and graphs)"""
|
||||
import matplotlib
|
||||
return
|
||||
|
||||
def test_import_matplotlib_pyplot():
|
||||
"""pyplot as a sub-library of matplotlib, which is used to plot images and graphs"""
|
||||
import matplotlib.pyplot as plt
|
||||
return
|
||||
|
||||
def test_import_tqdm_tqdm():
|
||||
"""tqdm is a neat utility library for simple display of progress in loops"""
|
||||
from tqdm import tqdm
|
||||
return
|
||||
|
||||
def test_import_pandas():
|
||||
"""pandas is useful to handle dataframes and read from .csv or .json files, which can be collected into joint DataFrame objects"""
|
||||
import pandas as pd
|
||||
return
|
||||
|
||||
def test_import_flask():
|
||||
"""flask is a WSGI framework for quick and easy design of web-based applications"""
|
||||
import flask
|
||||
from flask import Flask, Blueprint, request
|
||||
return
|
||||
|
||||
def test_import_flask_specific_objects():
|
||||
"""common flask objects, such as the Flask api object, the Blueprint and requests"""
|
||||
from flask import Flask, Blueprint, request
|
||||
return
|
||||
|
||||
|
||||
|
||||
def test_import_mysql_connector():
|
||||
"""the 'mysql.connector' Object is used for the BreCal server database"""
|
||||
import mysql.connector
|
||||
return
|
||||
|
||||
def test_import_pydapper():
|
||||
"""is a library that provides convenient methods for database related work"""
|
||||
import pydapper
|
||||
return
|
||||
|
||||
def test_import_webargs():
|
||||
"""currently used in ~/brecal/src/server/BreCal/api/berths.py"""
|
||||
import webargs
|
||||
from webargs.flaskparser import parser
|
||||
return
|
||||
|
||||
def test_import_mashmallow():
|
||||
"""currently used in ~/brecal/src/server/BreCal/api/shipcalls.py"""
|
||||
import marshmallow
|
||||
from marshmallow import Schema, fields
|
||||
return
|
||||
|
||||
def test_import_flask_jwt_extended():
|
||||
"""currently used in ~/brecal/src/server/BreCal/api/login.py"""
|
||||
import flask_jwt_extended
|
||||
from flask_jwt_extended import create_access_token
|
||||
return
|
||||
|
||||
def test_import_pyjwt():
|
||||
"""currently used in ~/brecal/src/server/BreCal/services/jwt_handler.py"""
|
||||
import jwt
|
||||
return
|
||||
|
||||
def test_import_bcrypt():
|
||||
"""currently used in ~/brecal/src/server/BreCal/impl/login.py"""
|
||||
import bcrypt
|
||||
return
|
||||
|
||||
if __name__=="__main__":
|
||||
test_import_colorama()
|
||||
test_import_matplotlib()
|
||||
test_import_matplotlib_pyplot()
|
||||
test_import_tqdm_tqdm()
|
||||
test_import_pandas()
|
||||
test_import_flask()
|
||||
|
||||
0
src/server/tests/__init__.py
Normal file
0
src/server/tests/__init__.py
Normal file
0
src/server/tests/api/__init__.py
Normal file
0
src/server/tests/api/__init__.py
Normal file
0
src/server/tests/impl/__init__.py
Normal file
0
src/server/tests/impl/__init__.py
Normal file
0
src/server/tests/schemas/__init__.py
Normal file
0
src/server/tests/schemas/__init__.py
Normal file
0
src/server/tests/services/__init__.py
Normal file
0
src/server/tests/services/__init__.py
Normal file
21
src/server/tests/test_create_app.py
Normal file
21
src/server/tests/test_create_app.py
Normal file
@ -0,0 +1,21 @@
|
||||
import pytest
|
||||
|
||||
def test_create_app():
|
||||
"""
|
||||
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
from brecal_utils import get_project_root
|
||||
|
||||
project_root = get_project_root("brecal")
|
||||
lib_location = os.path.join(project_root, "src", "server")
|
||||
sys.path.append(lib_location)
|
||||
|
||||
from BreCal import create_app
|
||||
os.chdir(project_root) # set the current directory to ~/brecal, so the config is found
|
||||
application = create_app()
|
||||
return
|
||||
|
||||
if __name__=="__main__":
|
||||
test_create_app()
|
||||
Reference in New Issue
Block a user