Skip to content

Commit

Permalink
DAS-None: change default python version. Clean up test scripts.
Browse files Browse the repository at this point in the history
This tweak is going wild.
  • Loading branch information
flamingbear committed Dec 10, 2024
1 parent c051954 commit b6b05f7
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 68 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/run_service_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,8 @@ jobs:
- name: Run test image
run: ./bin/run-test

- name: Archive test results
- name: Archive test results and coverage
uses: actions/upload-artifact@v4
with:
name: Test results
path: test-reports/

- name: Archive coverage report
uses: actions/upload-artifact@v4
with:
name: Coverage report
path: coverage/*
name: reports
path: reports/**/*
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ Changelog](http://keepachangelog.com/en/1.0.0/).
### Changed

* Changed pre-commit configuration to remove `black-jupyter` dependency [#38](https://github.com/nasa/harmony-browse-image-generator/pull/38)
* Updates service image's python to 3.12 [#38](https://github.com/nasa/harmony-browse-image-generator/pull/38)
* Simplifies test scripts to run with pytest and pytest plugins [#38](https://github.com/nasa/harmony-browse-image-generator/pull/38)

### Removed

* Removes `test_code_format.py` in favor of `ruff` pre-commit configuration [#38](https://github.com/nasa/harmony-browse-image-generator/pull/38)


## [v2.0.2] - 2024-10-15
Expand Down
2 changes: 1 addition & 1 deletion docker/service.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# and updates the entrypoint of the new service container
#
###############################################################################
FROM python:3.11
FROM python:3.12

WORKDIR "/home"

Expand Down
7 changes: 3 additions & 4 deletions tests/pip_test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
coverage~=7.6.0
pycodestyle~=2.12.0
pylint~=3.2.6
pytest~=8.3.1
unittest-xml-reporting~=3.2.0
pylint~=3.3.1
pytest-cov~=6.0.0
pytest~=8.3.3
27 changes: 9 additions & 18 deletions tests/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,19 @@ STATUS=0

export HDF5_DISABLE_VERSION_CHECK=1

# Run the standard set of unit tests, producing JUnit compatible output
coverage run -m pytest tests --junitxml=tests/reports/test-results-"$(date +'%Y%m%d%H%M%S')".xml
RESULT=$?

if [ "$RESULT" -ne "0" ]; then
STATUS=1
echo "ERROR: unittest generated errors"
fi
# Exit status used to report back to caller
STATUS=0

echo "\n"
echo "Test Coverage Estimates"
coverage report --omit="tests/*"
coverage html --omit="tests/*" -d tests/coverage
# Run the standard set of unit tests, producing JUnit compatible output
pytest --cov=hybig --cov=harmony_service \
--cov-report=html:reports/coverage \
--cov-report term \
--junitxml=reports/test-reports/test-results-"$(date +'%Y%m%d%H%M%S')".xml || STATUS=1

# Run pylint
# Ignored errors/warnings:
# W1203 - use of f-strings in log statements. This warning is leftover from
# using ''.format() vs % notation. For more information, see:
# https://github.com/PyCQA/pylint/issues/2354#issuecomment-414526879
pylint hybig harmony_service --disable=W1203
RESULT=$?
RESULT=$((3 & $RESULT))
pylint hybig harmony_service
RESULT=$((3 & $?))

if [ "$RESULT" -ne "0" ]; then
STATUS=1
Expand Down
35 changes: 0 additions & 35 deletions tests/test_code_format.py

This file was deleted.

1 change: 1 addition & 0 deletions tests/test_service/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Module definition for test_service."""
5 changes: 4 additions & 1 deletion tests/unit/test_sizes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from unittest import TestCase
from unittest.mock import MagicMock, patch

import pytest
import rasterio
from harmony_service_lib.message import Message
from rasterio import Affine
Expand Down Expand Up @@ -453,7 +454,9 @@ def test_scale_extent_from_input_image_with_crs_transformation(self):
)

actual_scale_extent = choose_scale_extent({}, target_crs, in_array)
self.assertEqual(actual_scale_extent, expected_scale_extent)
assert expected_scale_extent == pytest.approx(
actual_scale_extent, rel=1e-12
)


class TestChooseTargetDimensions(TestCase):
Expand Down

0 comments on commit b6b05f7

Please sign in to comment.