diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 75520091e64c870c9975174fda183c5d8fd5880b..ea5eb78bd8323b1dd7199dc5eb91e899b1d98f81 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -64,6 +64,7 @@ test: - rc=`cat .docker/result` - exit $rc dependencies: [cert] + needs: [cert] artifacts: paths: - caosdb_log.txt @@ -95,6 +96,7 @@ cert: tags: [docker] stage: cert image: $CI_REGISTRY_IMAGE + needs: [build-testenv] artifacts: paths: - .docker/cert/ @@ -106,6 +108,7 @@ style: tags: [docker] stage: style image: $CI_REGISTRY_IMAGE + needs: [] script: - make style allow_failure: true @@ -114,6 +117,7 @@ unittest: tags: [docker] stage: unittest image: $CI_REGISTRY_IMAGE + needs: [] script: - tox diff --git a/README_SETUP.md b/README_SETUP.md index 09a368a3d33f9fb2be799a5ba9961d293a2fd6c3..d33316612c1d2870c3b2c416e842df4220ecf858 100644 --- a/README_SETUP.md +++ b/README_SETUP.md @@ -48,7 +48,8 @@ Optional h5-crawler: `integrationtest/extroot/` directory. ## Code Formatting -`autopep8 -i -r ./` + +`make style` ## Documentation # diff --git a/integrationtests/test_assure_functions.py b/integrationtests/test_assure_functions.py index 56f9767a0f436201ab6003ffd88f631bdb089544..9f4e387d52f25382d18cfb21372a06346d2b5465 100644 --- a/integrationtests/test_assure_functions.py +++ b/integrationtests/test_assure_functions.py @@ -32,26 +32,25 @@ from caosadvancedtools.cfood import (assure_object_is_in_list) from caosadvancedtools.guard import (global_guard, RETRIEVE, UPDATE) -def setup_module(): +def setup(): """Delete all test entities.""" db.execute_query("FIND Test*").delete(raise_exception_on_error=False) -def setup(): +def setup_module(): """Allow all updates and delete test data""" global_guard.level = UPDATE - setup_module() + setup() -def teardown(): +def teardown_module(): """Reset guard level and delete test data.""" global_guard.level = RETRIEVE - setup_module() + setup() def test_assure_list_in_place(): """Test an in-place update with `assure_object_is_in_list`.""" - int_list_prop = db.Property(name="TestIntListProperty", datatype=db.LIST(db.INTEGER)).insert() rt1 = db.RecordType(name="TestType1").add_property( diff --git a/integrationtests/test_base_table_exporter_integration.py b/integrationtests/test_base_table_exporter_integration.py index 1c9158bd1d9600884571957d4916939f82c1a9ca..9d79e857fe706d78103ade3b92ee38498a2a1607 100644 --- a/integrationtests/test_base_table_exporter_integration.py +++ b/integrationtests/test_base_table_exporter_integration.py @@ -23,6 +23,7 @@ # ** end header # import caosdb as db +import pytest from caosadvancedtools import table_export as te @@ -85,8 +86,11 @@ def setup_module(): pass +@pytest.fixture(autouse=True) def setup(): - """No further setup""" + """Same as module setup.""" + setup_module() + yield None setup_module() diff --git a/integrationtests/test_crawl_with_datamodel_problems.py b/integrationtests/test_crawl_with_datamodel_problems.py index 61fec39026a1a3480ecc5b52551c712d7a459b08..0c6a145afdab682f82af09a17fb9aa0770769959 100644 --- a/integrationtests/test_crawl_with_datamodel_problems.py +++ b/integrationtests/test_crawl_with_datamodel_problems.py @@ -20,10 +20,11 @@ # along with this program. If not, see <https://www.gnu.org/licenses/>. # # ** end header -"""Test whether the crawler correctly identifies the data model -problems caused by a faulty model. + +"""Test whether the crawler correctly identifies the data model problems caused by a faulty model. """ + import caosdb as db from caosadvancedtools import loadFiles from caosadvancedtools.cfood import fileguide diff --git a/integrationtests/test_datamodel_problems.py b/integrationtests/test_datamodel_problems.py index 7d56f4da8eea34604ed1c820e14555f087c353bd..3bca302dd2a337cee7fd023ee6a64c5185bc99f5 100644 --- a/integrationtests/test_datamodel_problems.py +++ b/integrationtests/test_datamodel_problems.py @@ -44,12 +44,15 @@ def setup_module(): print(delete_exc) +@pytest.fixture(autouse=True) def setup(): - """No further setup""" + """Same as module setup.""" + setup_module() + yield None setup_module() -def teardown(): +def teardown_module(): """Clear and delete again.""" setup_module() diff --git a/setup.py b/setup.py index 8a2dcee8d0f4fb80986efa99d91176e653993c45..411a5c3dcd6ba362e7e7c8e6015e103acdf5bd31 100755 --- a/setup.py +++ b/setup.py @@ -154,10 +154,10 @@ def setup_package(): long_description_content_type="text/markdown", author='Henrik tom Wörden', author_email='h.tomwoerden@indiscale.com', - install_requires=["caosdb>=0.6.0", + install_requires=["caosdb>=0.7.0", + "numpy>=1.17.3", "openpyxl>=3.0.0", "pandas>=1.2.0", - "numpy>=1.17.3", "xlrd>=2.0", ], extras_require={"h5-crawler": ["h5py>=3.3.0", ], diff --git a/src/caosadvancedtools/cfood.py b/src/caosadvancedtools/cfood.py index 2c56e171d8e70789bc4f0dd3881a7d8e716e75f7..3c2d5408ef4d857f62ce4e908f90c4ffccef4d19 100644 --- a/src/caosadvancedtools/cfood.py +++ b/src/caosadvancedtools/cfood.py @@ -391,7 +391,7 @@ class AbstractFileCFood(AbstractCFood): def assure_object_is_in_list(obj, containing_object, property_name, to_be_updated=None, datatype=None): """Checks whether `obj` is one of the values in the list property - `property_name` of the supplied entity containing_object`. + `property_name` of the supplied entity `containing_object`. If this is the case this function returns. Otherwise the entity is added to the property `property_name` and the entity