diff --git a/.github/workflows/build-conda.yml b/.github/workflows/build-conda.yml new file mode 100644 index 0000000..6a4d244 --- /dev/null +++ b/.github/workflows/build-conda.yml @@ -0,0 +1,20 @@ +name: build_conda +on: + pull_request: + branches: + # for testing conda build w no upload during PRs + - main +jobs: + build: + runs-on: ubuntu-latest + container: + image: continuumio/miniconda3:latest + steps: + - name: Checkout Files + uses: actions/checkout@v4 + - name: Run Docker to Build + run: | + conda config --append channels conda-forge + conda config --append channels noaa-gfdl + conda install conda-build conda-verify + conda build . diff --git a/.github/workflows/conda-env-create-run-pytest.yml b/.github/workflows/conda-env-create-run-pytest.yml new file mode 100644 index 0000000..f1714f7 --- /dev/null +++ b/.github/workflows/conda-env-create-run-pytest.yml @@ -0,0 +1,76 @@ +name: conda-env-create-run-pytest + +on: [pull_request] + +jobs: + build-linux: + runs-on: ubuntu-latest + strategy: + max-parallel: 5 + + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Add conda to system path + run: | + # $CONDA is an environment variable pointing to the root of the miniconda directory + echo $CONDA/bin >> $GITHUB_PATH + + - name: Create catalogbuilder conda environment + run: | + # create environment catalogbuilder will be installed into + conda env create -f environment.yml --name catalogbuilder + # put conda env binaries in GITHUB_PATH + echo $CONDA/envs/catalogbuilder/bin >> $GITHUB_PATH + # install catalogbuilder to conda env directories + $CONDA/envs/catalogbuilder/bin/python -m pip install --prefix $CONDA/envs/catalogbuilder . + + - name: Run pytest in catalogbuilder conda environment + run: | + which python + python --version + $CONDA/envs/catalogbuilder/bin/python --version + # which pytest + $CONDA/envs/catalogbuilder/bin/pytest catalogbuilder + + - name: Make sample data + run: | + which python + python catalogbuilder/tests/make_sample_data.py + + - name: Generate catalog + run: | + which python + python catalogbuilder/scripts/gen_intake_gfdl.py archive/am5/am5/am5f3b1r0/c96L65_am5f3b1r0_pdclim1850F/gfdl.ncrc5-deploy-prod-openmp/pp gfdl_autotest + + - name: Generate catalog with yaml + run: | + which python + python catalogbuilder/scripts/gen_intake_gfdl.py --config catalogbuilder/tests/test_config.yaml + + - name: upload-artifacts + uses: actions/upload-artifact@v4 + with: + name: workflow-artifacts1 + path: | + gfdl_autotest.csv + gfdl_autotest.json + cats/gfdl_autotest_from_yaml.csv + cats/gfdl_autotest_from_yaml.json + + - name: Download all workflow run artifacts + uses: actions/download-artifact@v4 + + - name: Run pytest with downloaded artifacts + run: | + $CONDA/envs/catalogbuilder/bin/pytest -v --runxfail catalogbuilder + + - name: Test for completeness + run: | + which python + python catalogbuilder/scripts/test_catalog.py -tf gfdl_autotest.json catalogbuilder/cats/gfdl_template.json + python catalogbuilder/scripts/test_catalog.py -tf catalogbuilder/cats/gfdl_autotest_from_yaml.json diff --git a/.github/workflows/create-gfdl-catalog.yml b/.github/workflows/create-gfdl-catalog.yml deleted file mode 100644 index 7961673..0000000 --- a/.github/workflows/create-gfdl-catalog.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: create-gfdl-catalog -#This actions workflow generates sample input directory structure/files (empty ATM) on the fly -#runs catalog builder to generate a csv file and the json file which is also cached and saved as an artifact for reference in the -#actions pipeline. We download the artifacts and use them in the dynamic pytests. -#pytests are run, which also comprises of one test that runs intake-esm open calls on the dynamic catalog (corresponding -#esm collection spec is in the repo - -on: - pull_request: - branches: - - 'main' -jobs: - catalog-upload: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.10 - uses: actions/setup-python@v3 - with: - python-version: '3.10' - - name: Add conda to system path - run: | - # $CONDA is an environment variable pointing to the root of the miniconda directory - echo $CONDA/bin >> $GITHUB_PATH - - name: Install dependencies - run: | - conda env create -f environment.yml --name catalogbuilder - - name: Make sample data - run: python tests/make_sample_data.py - - name: 'Generate catalog' - run: | - $CONDA/envs/catalogbuilder/bin/python catalogbuilder/scripts/gen_intake_gfdl.py archive/am5/am5/am5f3b1r0/c96L65_am5f3b1r0_pdclim1850F/gfdl.ncrc5-deploy-prod-openmp/pp gfdl_autotest - - name: 'Generate catalog with yaml' - run: | - $CONDA/envs/catalogbuilder/bin/python catalogbuilder/scripts/gen_intake_gfdl.py --config tests/test_config.yaml - - name: upload-artifacts1 - uses: actions/upload-artifact@v4 - with: - name: workflow-artifacts1 - path: | - gfdl_autotest.csv - gfdl_autotest.json - cats/gfdl_autotest_from_yaml.csv - cats/gfdl_autotest_from_yaml.json - - name: Download all workflow run artifacts - uses: actions/download-artifact@v4 - - name: Test with pytest - run: | - conda install pytest - $CONDA/envs/catalogbuilder/bin/pytest -v --runxfail - - name: Test for completeness - run: | - $CONDA/envs/catalogbuilder/bin/python catalogbuilder/scripts/test_catalog.py -tf gfdl_autotest.json catalogbuilder/cats/gfdl_template.json - $CONDA/envs/catalogbuilder/bin/python catalogbuilder/scripts/test_catalog.py -tf catalogbuilder/cats/gfdl_autotest_from_yaml.json diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml deleted file mode 100644 index 5948850..0000000 --- a/.github/workflows/docker-image.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Docker Image CI - -on: - push: - branches: [ actionstest ] - pull_request: - branches: [ actionstest ] - -jobs: - - build: - - runs-on: ubuntu-latest - - steps: - - uses: aradhakrishnan/CatalogyBuilder@v1 - - name: Build the Docker image - run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) diff --git a/.github/workflows/docker-image2.yml b/.github/workflows/docker-image2.yml deleted file mode 100644 index 5c2a1ed..0000000 --- a/.github/workflows/docker-image2.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Docker Image CI - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - - build: - - runs-on: ubuntu-latest - - steps: - - uses: aradhakrishnanGFDL/CatalogBuilder@v1 - - name: Build the Docker image - run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 800e5d7..da4f937 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -11,12 +11,15 @@ jobs: steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v3 + - name: Install dependencies run: | pip install sphinx sphinx_rtd_theme myst_parser piccolo_theme + - name: Sphinx build run: | sphinx-build doc _build + - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v3 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index bd5ea56..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,15 +0,0 @@ -on: [push] - -jobs: - hello_world_job: - runs-on: ubuntu-latest - name: A job to say hello - steps: - - name: Hello world action step - id: hello - uses: aradhakrishnanGFDL/CatalogBuilder@v2 - with: - who-to-greet: 'test user' - # Use the output from the `hello` step - - name: Get the output time - run: echo "The time was ${{ steps.hello.outputs.time }}" diff --git a/.github/workflows/publish-conda.yml b/.github/workflows/publish-conda.yml index 580a588..487e0cf 100644 --- a/.github/workflows/publish-conda.yml +++ b/.github/workflows/publish-conda.yml @@ -1,11 +1,11 @@ name: publish_conda on: - pull_request: + push: branches: - #for testing the restructuring, back on push only later. + # only upload upon MR acceptance. - main jobs: - build_and_publish: + publish: runs-on: ubuntu-latest container: image: continuumio/miniconda3:latest diff --git a/.github/workflows/python-conda-env.yml b/.github/workflows/python-conda-env.yml deleted file mode 100644 index 5832b92..0000000 --- a/.github/workflows/python-conda-env.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Build conda pkg and run tests - -on: [push] - -jobs: - build-linux: - runs-on: ubuntu-latest - strategy: - max-parallel: 5 - - steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.10 - uses: actions/setup-python@v3 - with: - python-version: '3.10' - - name: Add conda to system path - run: | - # $CONDA is an environment variable pointing to the root of the miniconda directory - echo $CONDA/bin >> $GITHUB_PATH - - name: Install dependencies - run: | - conda env create -f environment.yml --name catalogbuilder - - name: Import Test with pytest - run: | - conda install pytest - $CONDA/envs/catalogbuilder/bin/pytest diff --git a/MANIFEST.in b/MANIFEST.in index 493b978..01fba10 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,2 @@ -recursive-include cats * +recursive-include catalogbuilder/cats * diff --git a/catalogbuilder/intakebuilder/CSVwriter.py b/catalogbuilder/intakebuilder/CSVwriter.py index 9a6a33f..021bf9c 100644 --- a/catalogbuilder/intakebuilder/CSVwriter.py +++ b/catalogbuilder/intakebuilder/CSVwriter.py @@ -1,7 +1,8 @@ import os.path import csv from csv import writer -from intakebuilder import builderconfig, configparser +#from intakebuilder import builderconfig, configparser +from . import builderconfig, configparser def getHeader(configyaml): ''' diff --git a/catalogbuilder/intakebuilder/getinfo.py b/catalogbuilder/intakebuilder/getinfo.py index d974c29..5cbabaa 100644 --- a/catalogbuilder/intakebuilder/getinfo.py +++ b/catalogbuilder/intakebuilder/getinfo.py @@ -4,7 +4,8 @@ from csv import writer import os import xarray as xr -from intakebuilder import builderconfig, configparser +#from intakebuilder import builderconfig, configparser +from . import builderconfig, configparser ''' diff --git a/catalogbuilder/intakebuilder/gfdlcrawler.py b/catalogbuilder/intakebuilder/gfdlcrawler.py index dd81c04..0c451fe 100644 --- a/catalogbuilder/intakebuilder/gfdlcrawler.py +++ b/catalogbuilder/intakebuilder/gfdlcrawler.py @@ -1,5 +1,6 @@ import os -from intakebuilder import getinfo, builderconfig +#from intakebuilder import getinfo, builderconfig +from . import getinfo, builderconfig import sys import re import operator as op diff --git a/catalogbuilder/intakebuilder/localcrawler.py b/catalogbuilder/intakebuilder/localcrawler.py index ac43810..49d4eef 100644 --- a/catalogbuilder/intakebuilder/localcrawler.py +++ b/catalogbuilder/intakebuilder/localcrawler.py @@ -1,5 +1,6 @@ import os -from intakebuilder import getinfo +#from intakebuilder import getinfo +from . import getinfo import re ''' localcrawler crawls through the local file path, then calls helper functions in the package to getinfo. diff --git a/catalogbuilder/intakebuilder/s3crawler.py b/catalogbuilder/intakebuilder/s3crawler.py index e55d676..2f7ce85 100644 --- a/catalogbuilder/intakebuilder/s3crawler.py +++ b/catalogbuilder/intakebuilder/s3crawler.py @@ -1,7 +1,8 @@ import re import boto3 import botocore -from intakebuilder import getinfo +#from intakebuilder import getinfo +from . import getinfo ''' s3 crawler crawls through the S3 bucket, passes the bucket path to the helper functions to getinfo. diff --git a/catalogbuilder/pytest.ini b/catalogbuilder/pytest.ini new file mode 100644 index 0000000..ebb3014 --- /dev/null +++ b/catalogbuilder/pytest.ini @@ -0,0 +1,3 @@ +[pytest] +testpaths = + catalogbuilder/tests \ No newline at end of file diff --git a/catalogbuilder/scripts/gen_intake_gfdl.py b/catalogbuilder/scripts/gen_intake_gfdl.py index a99b667..54fd2d0 100755 --- a/catalogbuilder/scripts/gen_intake_gfdl.py +++ b/catalogbuilder/scripts/gen_intake_gfdl.py @@ -11,7 +11,8 @@ logger.setLevel(logging.INFO) try: - from intakebuilder import gfdlcrawler, CSVwriter, builderconfig, configparser + #from intakebuilder import gfdlcrawler, CSVwriter, builderconfig, configparser + from catalogbuilder.intakebuilder import gfdlcrawler, CSVwriter, builderconfig, configparser except ModuleNotFoundError: print("The module intakebuilder is not installed. Do you have intakebuilder in your sys.path or have you activated the conda environment with the intakebuilder package in it? ") print("Attempting again with adjusted sys.path ") diff --git a/catalogbuilder/scripts/gen_intake_gfdl_runner.py b/catalogbuilder/scripts/gen_intake_gfdl_runner.py index 2f487b9..52ac5f9 100755 --- a/catalogbuilder/scripts/gen_intake_gfdl_runner.py +++ b/catalogbuilder/scripts/gen_intake_gfdl_runner.py @@ -1,7 +1,8 @@ #!/usr/bin/env python #TODO test after conda pkg is published and make changes as needed -from catalogbuilder.scripts import gen_intake_gfdl +#from catalogbuilder.scripts import gen_intake_gfdl +from . import gen_intake_gfdl import sys input_path = "/archive/am5/am5/am5f3b1r0/c96L65_am5f3b1r0_pdclim1850F/gfdl.ncrc5-deploy-prod-openmp/pp/" diff --git a/catalogbuilder/scripts/gen_intake_gfdl_runner_config.py b/catalogbuilder/scripts/gen_intake_gfdl_runner_config.py index 86fb91f..ffc9b9d 100755 --- a/catalogbuilder/scripts/gen_intake_gfdl_runner_config.py +++ b/catalogbuilder/scripts/gen_intake_gfdl_runner_config.py @@ -1,8 +1,10 @@ #!/usr/bin/env python -from catalogbuilder.scripts import gen_intake_gfdl +#from catalogbuilder.scripts import gen_intake_gfdl +from . import gen_intake_gfdl import sys +# this will break at some point #TODO sys.argv = ['input_path','--config', '/home/a1r/github/CatalogBuilder/scripts/configs/config-example.yml'] print(sys.argv) gen_intake_gfdl.main() diff --git a/catalogbuilder/scripts/gen_intake_local.py b/catalogbuilder/scripts/gen_intake_local.py index 673cd16..dc2bf0a 100755 --- a/catalogbuilder/scripts/gen_intake_local.py +++ b/catalogbuilder/scripts/gen_intake_local.py @@ -1,10 +1,11 @@ #!/usr/bin/env python import os -from intakebuilder import localcrawler, CSVwriter +#from intakebuilder import localcrawler, CSVwriter +from . import localcrawler, CSVwriter import logging logger = logging.getLogger('local') -hdlr = logging.FileHandler('/nbhome/a1r/logs/local.log') +hdlr = logging.FileHandler('/nbhome/a1r/logs/local.log') #TODO this will break logger.addHandler(hdlr) logger.setLevel(logging.INFO) diff --git a/catalogbuilder/scripts/gen_intake_s3.py b/catalogbuilder/scripts/gen_intake_s3.py index 69a8afb..5c8acbb 100755 --- a/catalogbuilder/scripts/gen_intake_s3.py +++ b/catalogbuilder/scripts/gen_intake_s3.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import os -from intakebuilder import getinfo, s3crawler, CSVwriter +#from intakebuilder import getinfo, s3crawler, CSVwriter +from . import getinfo, s3crawler, CSVwriter import logging logger = logging.getLogger('local') hdlr = logging.FileHandler('/Users/ar46/logs/local.log') diff --git a/tests/__init__.py b/catalogbuilder/tests/__init__.py similarity index 100% rename from tests/__init__.py rename to catalogbuilder/tests/__init__.py diff --git a/tests/compval b/catalogbuilder/tests/compval similarity index 100% rename from tests/compval rename to catalogbuilder/tests/compval diff --git a/tests/make_sample_data.py b/catalogbuilder/tests/make_sample_data.py similarity index 100% rename from tests/make_sample_data.py rename to catalogbuilder/tests/make_sample_data.py diff --git a/tests/subdirs.py b/catalogbuilder/tests/subdirs.py similarity index 100% rename from tests/subdirs.py rename to catalogbuilder/tests/subdirs.py diff --git a/tests/test_ci_dynamic.py b/catalogbuilder/tests/test_ci_dynamic.py similarity index 93% rename from tests/test_ci_dynamic.py rename to catalogbuilder/tests/test_ci_dynamic.py index 9520769..9ba2a70 100644 --- a/tests/test_ci_dynamic.py +++ b/catalogbuilder/tests/test_ci_dynamic.py @@ -32,7 +32,7 @@ def test_loadcat(): #todo check if its readable etc #we are using the dynamically generated csv and json for testing in this routine #leveraging GitHub actions CI workflow and manifests and caches - catspec = pathlib.Path(os.path.dirname(__file__)).parent / 'workflow-artifacts1/gfdl_autotest.json' + catspec = pathlib.Path(os.path.dirname(__file__)).parent / '../workflow-artifacts1/gfdl_autotest.json' cat = load_cat((str(catspec))) try: assert isinstance(cat.df, pd.DataFrame),"test failed" diff --git a/tests/test_config.yaml b/catalogbuilder/tests/test_config.yaml similarity index 100% rename from tests/test_config.yaml rename to catalogbuilder/tests/test_config.yaml diff --git a/catalogbuilder/tests/test_import.py b/catalogbuilder/tests/test_import.py new file mode 100644 index 0000000..69413db --- /dev/null +++ b/catalogbuilder/tests/test_import.py @@ -0,0 +1,34 @@ +import os,sys + +#def check_import(): +# try: +# import catalogbuilder +# import catalogbuilder.intakebuilder +# from catalogbuilder.intakebuilder import gfdlcrawler, CSVwriter, configparser +# except ImportError: +# print("The module intakebuilder is not installed. Do you have intakebuilder in your sys.path or have you activated the conda environment with the intakebuilder package in it? ") +# print("Attempting again with adjusted sys.path ") +# +# try: +# #candobetter with actual conda package built before this, but this is a decent test for those that do not use conda package +# sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))+"/catalogbuilder") +# from intakebuilder import gfdlcrawler, CSVwriter, builderconfig, configparser +# except: +# print("Unable to adjust sys.path") +# raise ImportError('Error importing intakebuilder and other packages') +# return -97 +# return True + +def test_import1(): + import catalogbuilder + assert catalogbuilder is not None + +def test_import2(): + import catalogbuilder.intakebuilder + assert catalogbuilder.intakebuilder is not None + +def test_import3(): + from catalogbuilder.intakebuilder import gfdlcrawler, CSVwriter, configparser + assert not None in [gfdlcrawler, CSVwriter, configparser] + + diff --git a/tests/test_ingestion.py b/catalogbuilder/tests/test_ingestion.py similarity index 95% rename from tests/test_ingestion.py rename to catalogbuilder/tests/test_ingestion.py index 13b6aec..f721ec2 100755 --- a/tests/test_ingestion.py +++ b/catalogbuilder/tests/test_ingestion.py @@ -19,9 +19,10 @@ def load_cat(catspec=None): except BaseException as e: print("Can't load this catalog",str(e)) return cat + def test_loadcat(): #TODO generate csv on the fly, check if its readable etc - catspec = pathlib.Path(os.path.dirname(__file__)).parent / 'catalogbuilder/cats/gfdl_template.json' + catspec = pathlib.Path(os.path.dirname(__file__)).parent / 'cats/gfdl_template.json' #TODO generate test catalog on the fly, push spec to the test directory cat = load_cat((str(catspec))) try: diff --git a/doc/generation.rst b/doc/generation.rst index 86c1fa4..3968e73 100644 --- a/doc/generation.rst +++ b/doc/generation.rst @@ -6,11 +6,11 @@ There are a few ways to use the catalog builder. Installation ------------ -Recommended approach: Install as a `conda package `_ +Recommended approach: Install as a `conda package `_ .. code-block:: console - conda install intakebuilder -c noaa-gfdl + conda install catalogbuilder -c noaa-gfdl Alternatively, you may clone the `git repository `_ and create your conda environment using the `environment.yml `_ in the git repository. @@ -33,7 +33,7 @@ Using conda package .. code-block:: console - conda install intakebuilder -c noaa-gfdl + conda install catalogbuilder -c noaa-gfdl This package contains all dependencies needed to run the catalog builder. @@ -115,7 +115,7 @@ Optional Configuration If you want to work with datasets and directories that are *not quite* GFDL post-processed directory oriented: -Catalog headers (column names) are set with the *HEADER LIST* variable. The *OUTPUT PATH TEMPLATE* variable controls the expected directory structure of input data. Both can be configured by editing intakebuilder/builderconfig.py. +Catalog headers (column names) are set with the *HEADER LIST* variable. The *OUTPUT PATH TEMPLATE* variable controls the expected directory structure of input data. Both can be configured by editing catalogbuilder/intakebuilder/builderconfig.py. .. code-block:: python diff --git a/environment.yml b/environment.yml index 9c0683c..d79469d 100644 --- a/environment.yml +++ b/environment.yml @@ -1,25 +1,14 @@ name: catalogbuilder channels: - conda-forge - - default + - noaa-gfdl + - defaults dependencies: - - conda - - python=3.7 - - conda-env - - conda-build - - conda-verify - - _ipyw_jlab_nb_ext_conf - - anaconda==2020.02=py37_0 - - anaconda-navigator - - navigator-updater - - gcsfs - - zarr - - cftime - - cartopy - - xgcm - - pandas - - xarray + - python + - pytest - click - - intake-esm - - pyyaml + - xarray + - pandas - jsondiff + - intake-esm + - boto3 diff --git a/meta.yaml b/meta.yaml index 87791fa..67cdbed 100644 --- a/meta.yaml +++ b/meta.yaml @@ -3,9 +3,9 @@ package: version: 2.0.1 source: - git_url: https://github.com/NOAA-GFDL/CatalogBuilder.git - git_branch: subpkgtest path: . +# thank you bennet- the git url messes with conda build, which +# automatically checks out the default branch when given a URL build: script: "{{ PYTHON }} -m pip install . -vv" @@ -27,7 +27,8 @@ requirements: test: imports: - catalogbuilder - - catalogbuilder.scripts - catalogbuilder.cats + - catalogbuilder.scripts + - catalogbuilder.scripts.gen_intake_gfdl about: home: diff --git a/tests/__pycache__/__init__.cpython-39.pyc b/tests/__pycache__/__init__.cpython-39.pyc deleted file mode 100644 index 37859c7..0000000 Binary files a/tests/__pycache__/__init__.cpython-39.pyc and /dev/null differ diff --git a/tests/__pycache__/test_catalog.cpython-39-pytest-7.4.0.pyc b/tests/__pycache__/test_catalog.cpython-39-pytest-7.4.0.pyc deleted file mode 100644 index 857c5b1..0000000 Binary files a/tests/__pycache__/test_catalog.cpython-39-pytest-7.4.0.pyc and /dev/null differ diff --git a/tests/__pycache__/test_import.cpython-39-pytest-7.4.0.pyc b/tests/__pycache__/test_import.cpython-39-pytest-7.4.0.pyc deleted file mode 100644 index 464354b..0000000 Binary files a/tests/__pycache__/test_import.cpython-39-pytest-7.4.0.pyc and /dev/null differ diff --git a/tests/test_import.py b/tests/test_import.py deleted file mode 100644 index e5d5213..0000000 --- a/tests/test_import.py +++ /dev/null @@ -1,21 +0,0 @@ -import os,sys -def check_import(): - try: - from intakebuilder import gfdlcrawler, CSVwriter, configparser - except ImportError: - print("The module intakebuilder is not installed. Do you have intakebuilder in your sys.path or have you activated the conda environment with the intakebuilder package in it? ") - print("Attempting again with adjusted sys.path ") - try: - #candobetter with actual conda package built before this, but this is a decent test for those that do not use conda package - sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))+"/catalogbuilder") - from intakebuilder import gfdlcrawler, CSVwriter, builderconfig, configparser - except: - print("Unable to adjust sys.path") - raise ImportError('Error importing intakebuilder and other packages') - return -97 - return True - -def test_import(): - assert check_import() == True - -