Skip to content

Commit b6b05f7

Browse files
committed
DAS-None: change default python version. Clean up test scripts.
This tweak is going wild.
1 parent c051954 commit b6b05f7

File tree

8 files changed

+27
-68
lines changed

8 files changed

+27
-68
lines changed

.github/workflows/run_service_tests.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,8 @@ jobs:
2929
- name: Run test image
3030
run: ./bin/run-test
3131

32-
- name: Archive test results
32+
- name: Archive test results and coverage
3333
uses: actions/upload-artifact@v4
3434
with:
35-
name: Test results
36-
path: test-reports/
37-
38-
- name: Archive coverage report
39-
uses: actions/upload-artifact@v4
40-
with:
41-
name: Coverage report
42-
path: coverage/*
35+
name: reports
36+
path: reports/**/*

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ Changelog](http://keepachangelog.com/en/1.0.0/).
99
### Changed
1010

1111
* Changed pre-commit configuration to remove `black-jupyter` dependency [#38](https://github.com/nasa/harmony-browse-image-generator/pull/38)
12+
* Updates service image's python to 3.12 [#38](https://github.com/nasa/harmony-browse-image-generator/pull/38)
13+
* Simplifies test scripts to run with pytest and pytest plugins [#38](https://github.com/nasa/harmony-browse-image-generator/pull/38)
14+
15+
### Removed
16+
17+
* Removes `test_code_format.py` in favor of `ruff` pre-commit configuration [#38](https://github.com/nasa/harmony-browse-image-generator/pull/38)
1218

1319

1420
## [v2.0.2] - 2024-10-15

docker/service.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# and updates the entrypoint of the new service container
1616
#
1717
###############################################################################
18-
FROM python:3.11
18+
FROM python:3.12
1919

2020
WORKDIR "/home"
2121

tests/pip_test_requirements.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
coverage~=7.6.0
21
pycodestyle~=2.12.0
3-
pylint~=3.2.6
4-
pytest~=8.3.1
5-
unittest-xml-reporting~=3.2.0
2+
pylint~=3.3.1
3+
pytest-cov~=6.0.0
4+
pytest~=8.3.3

tests/run_tests.sh

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,19 @@ STATUS=0
2020

2121
export HDF5_DISABLE_VERSION_CHECK=1
2222

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

27-
if [ "$RESULT" -ne "0" ]; then
28-
STATUS=1
29-
echo "ERROR: unittest generated errors"
30-
fi
24+
# Exit status used to report back to caller
25+
STATUS=0
3126

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

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

4637
if [ "$RESULT" -ne "0" ]; then
4738
STATUS=1

tests/test_code_format.py

Lines changed: 0 additions & 35 deletions
This file was deleted.

tests/test_service/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Module definition for test_service."""

tests/unit/test_sizes.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from unittest import TestCase
55
from unittest.mock import MagicMock, patch
66

7+
import pytest
78
import rasterio
89
from harmony_service_lib.message import Message
910
from rasterio import Affine
@@ -453,7 +454,9 @@ def test_scale_extent_from_input_image_with_crs_transformation(self):
453454
)
454455

455456
actual_scale_extent = choose_scale_extent({}, target_crs, in_array)
456-
self.assertEqual(actual_scale_extent, expected_scale_extent)
457+
assert expected_scale_extent == pytest.approx(
458+
actual_scale_extent, rel=1e-12
459+
)
457460

458461

459462
class TestChooseTargetDimensions(TestCase):

0 commit comments

Comments
 (0)