diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5e0f9b34c3a87fb4c04204dfe94ac39cd92d34a1..fa9b1af56fc7b979b2c05c903dd2a2731c1cd7f3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,52 +15,52 @@ cache: - .cache/pip stages: -- static analysis - test before_script: - pip install -e .[dev] -flake8: - image: python:3.6 - tags: - - passoft - stage: static analysis - script: - - flake8 --ignore=E722,E712 data2passcal - - flake8 --ignore=E722,E712 tests - python2.7: image: python:2.7 tags: - passoft stage: test - script: tox -e py27 + script: + - tox -e py27 + - tox -e flake8 python3.5: image: python:3.5 tags: - passoft stage: test - script: tox -e py35 + script: + - tox -e py35 + - tox -e flake8 python3.6: image: python:3.6 tags: - passoft stage: test - script: tox -e py36 + script: + - tox -e py36 + - tox -e flake8 python3.7: image: python:3.7 tags: - passoft stage: test - script: tox -e py37 + script: + - tox -e py37 + - tox -e flake8 python3.8: image: python:3.8 tags: - passoft stage: test - script: tox -e py38 + script: + - tox -e py38 + - tox -e flake8 diff --git a/Makefile b/Makefile deleted file mode 100644 index 4e77fd3a863b81f157d1969115b8592e5a8bba96..0000000000000000000000000000000000000000 --- a/Makefile +++ /dev/null @@ -1,69 +0,0 @@ -.PHONY: clean clean-test clean-pyc clean-build docs help -.DEFAULT_GOAL := help - -define BROWSER_PYSCRIPT -import os, webbrowser, sys - -try: - from urllib import pathname2url -except: - from urllib.request import pathname2url - -webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1]))) -endef -export BROWSER_PYSCRIPT - -define PRINT_HELP_PYSCRIPT -import re, sys - -for line in sys.stdin: - match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line) - if match: - target, help = match.groups() - print("%-20s %s" % (target, help)) -endef -export PRINT_HELP_PYSCRIPT - -BROWSER := python -c "$$BROWSER_PYSCRIPT" - -help: - @python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST) - -## remove all build, test, coverage and Python artifacts -clean: clean-build clean-pyc clean-test - -## remove build artifacts -clean-build: - rm -fr build/ - rm -fr dist/ - rm -fr .eggs/ - find . -name '*.egg-info' -exec rm -fr {} + - find . -name '*.egg' -exec rm -f {} + - -## remove Python file artifacts -clean-pyc: - find . -name '*.pyc' -exec rm -f {} + - find . -name '*.pyo' -exec rm -f {} + - find . -name '*~' -exec rm -f {} + - find . -name '__pycache__' -exec rm -fr {} + - -## remove test artifacts -clean-test: - rm -fr .tox/ - rm -fr .pytest_cache - -## check style with flake8 -lint: - flake8 data2passcal tests - -## run tests quickly with the default Python - deprecated -test: - python setup.py test - -## run tests on every Python version with tox -test-all: - tox - -## install the package to the active Python's site-packages -install: clean - python setup.py install diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index b6bd1f21aa3ec4e2cccfad098de819a662c87d8e..ecfa27df20eaba1e8fa3dc106867aef7357d34a8 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -12,7 +12,7 @@ build: - data2passcal = data2passcal.data2passcal:main requirements: - host: + build: - python - setuptools run: diff --git a/data2passcal/data2passcal.py b/data2passcal/data2passcal.py index 813988c06e01ab766f0ee651ca3fd4d47483a5bd..38be7fc2c54905cead6ae7281a1eff5c2394d1aa 100644 --- a/data2passcal/data2passcal.py +++ b/data2passcal/data2passcal.py @@ -128,10 +128,9 @@ def sendable(file): # Basic Miniseed file metadata extracted from filename -# This includes .p files which we may accept in the future but won't h -MseedRE = re.compile( +# This includes .p files which we may accept in the future MseedRE = re.compile(r'\A(.*)\.([A-Z0-9][A-Z0-9])\.(.*)\.' - r'([A-Z][A-Z]\w)\.([0-9]{4})\.([0-9]{3})(?:\.p)*') + r'([A-Z][A-Z]\w)\.([0-9]{4})\.([0-9]{3})(?:\.p)*') def filename_qc_format(file): diff --git a/tests/test_data2passcal.py b/tests/test_data2passcal.py index 1c30d5389485e7463c27c6f16cad75caaa35a0a2..b2da579aa290f16ceaafb9d53fb67d3032b1f97d 100644 --- a/tests/test_data2passcal.py +++ b/tests/test_data2passcal.py @@ -10,9 +10,9 @@ import os import sys import unittest -from data2passcal.data2passcal import get_FTP, ismseed, scan_dir, send2passcal from data2passcal.data2passcal import (get_FTP, ismseed, scan_dir, - send2passcal,FTP_CONNECT_ATTEMPTS, FTP_SEND_ATTEMPTS) + send2passcal, FTP_CONNECT_ATTEMPTS, + FTP_SEND_ATTEMPTS) if sys.version_info < (3, 3): from mock import patch @@ -30,7 +30,8 @@ class TestData2passcal(unittest.TestCase): def setUp(self): """Set up test fixtures, if any""" dir_testdata = os.path.dirname(os.path.realpath(__file__)) + '/test_data' # noqa - filelist = [x for x in scan_dir(dir_testdata) + filelist = ['/'.join([dir_testdata, x]) + for x in os.listdir(dir_testdata) if not os.path.basename(x).startswith('.') and not os.path.basename(x).endswith('.log')] self.dir_testdata = dir_testdata @@ -42,10 +43,14 @@ class TestData2passcal(unittest.TestCase): Only 5 files available under ./test_data directory Not taking into account .DS_STORE file """ - filelist = [x for x in scan_dir(self.dir_testdata) - if not os.path.basename(x).startswith('.') and not - os.path.basename(x).endswith('.log')] - self.assertEqual(len(filelist), 5, 'Incorrect number of files') + filelist_test = [x for x in scan_dir(self.dir_testdata) + if not os.path.basename(x).startswith('.') and not + os.path.basename(x).endswith('.log')] + self.assertEqual(len(filelist_test), len(self.filelist), + 'Incorrect number of files') + for f in filelist_test: + self.assertIn(f, self.filelist, 'File {0} not found in {1}' + .format(f, self.dir_testdata)) def test_ismseed(self): """Test basic functionality of ismseed function""" diff --git a/tox.ini b/tox.ini index e6b05323c206bffb5efa246f8043ced2cf4b07ef..d540347ac0778a0b4191880cc38dd25f4547cd2b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,14 +1,6 @@ [tox] envlist = py27, py35, py36, py37, py38, flake8 -[travis] -python = - 2.7: py27 - 3.5: py35 - 3.6: py36 - 3.7: py37 - 3.8: py38 - [testenv:flake8] basepython = python deps = flake8