Skip to content

Commit

Permalink
test refactors - kamangir/bolt#1234
Browse files Browse the repository at this point in the history
  • Loading branch information
kamangir committed Mar 4, 2024
1 parent 0c43938 commit 75e0e32
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 21 deletions.
5 changes: 5 additions & 0 deletions .abcli/hubble.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ function abcli_hubble() {
abcli_hubble_list "$@"
abcli_hubble_select "$@"

local task
for task in pylint pytest test; do
abcli_hubble $task "$@"
done

if [ "$(abcli_keyword_is $2 verbose)" == true ]; then
python3 -m hubble --help
fi
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Pylint

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
- name: Analysing the code with pylint
run: |
pylint -d W1203,C0103,C0111,C0114,C0115,C0116,C0411,W0404,W0237,C0209,C0415,W0621,W0702,W0102,W1202,E0401,W1514,C3002,W0401,W0611,C0413,C0412,W0603,R0911,E1101,W0622,R1721,W0718,R1728,C3001,R0801,R0401,R0914,R0913,R0915,W0123,R0912,C0301,W0511,W0105,W0613,R0902,R0903,R1735,W1401,W3101,W1308,E1102 $(git ls-files '*.py')
25 changes: 25 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: pytest

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install pytest
pip install -r requirements.txt
- name: Run tests
run: |
pytest
7 changes: 3 additions & 4 deletions hubble/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
NAME = "hubble"

VERSION = "3.298.1"
ICON = "🔭"

DESCRIPTION = "🔭 tools to access and process Hubble Space Telescope imagery and other datasets on AWS Open Data Registry."
DESCRIPTION = f"{ICON} tools to access and process Hubble Space Telescope imagery and other datasets on AWS Open Data Registry."

from hubble.datasets import *
from hubble.fits import *
VERSION = "3.299.1"
5 changes: 1 addition & 4 deletions hubble/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
from hubble.datasets import get
from hubble.ingest import ingest
from hubble import NAME, VERSION, DESCRIPTION
from abcli import logging
import logging

logger = logging.getLogger(__name__)
from hubble.logger import logger

parser = argparse.ArgumentParser(NAME, description=f"{NAME}-{VERSION}")
parser.add_argument(
Expand Down
5 changes: 1 addition & 4 deletions hubble/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
from abcli import env, file
from typing import Any
from abcli import string
from abcli import logging
import logging

logger = logging.getLogger(__name__)
from hubble.logger import logger


# https://registry.opendata.aws/hst/
Expand Down
5 changes: 1 addition & 4 deletions hubble/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
from abcli import file
from hubble.fits import load_fit_file
from abcli.modules import objects
from abcli import logging
import logging

logger = logging.getLogger(__name__)
from hubble.logger import logger


def ingest(
Expand Down
4 changes: 4 additions & 0 deletions hubble/logger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from abcli.logger import logging
from hubble import ICON

logger = logging.getLogger(f"{ICON} ")
6 changes: 1 addition & 5 deletions notebooks/hst.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@
"from abcli.plugins import seed\n",
"from hubble import NAME, VERSION\n",
"from hubble.ingest import ingest\n",
"\n",
"import abcli.logging\n",
"import logging\n",
"\n",
"logger = logging.getLogger()\n",
"from abcli.logger import logger\n",
"\n",
"logger.info(f\"{NAME}.{VERSION}.{fullname()}, built on {string.pretty_date()}\")"
]
Expand Down

0 comments on commit 75e0e32

Please sign in to comment.