This is an automated email from the ASF dual-hosted git repository.
rkk pushed a commit to branch SDAP-521
in repository https://gitbox.apache.org/repos/asf/sdap-nexus.git
The following commit(s) were added to refs/heads/SDAP-521 by this push:
new 8bbbec3 Guide for install and run
8bbbec3 is described below
commit 8bbbec3f91da3b6bc845162f5fa5ee8f31296a24
Author: rileykk <[email protected]>
AuthorDate: Fri Jul 5 10:37:12 2024 -0700
Guide for install and run
---
docs/release.rst | 2 +-
docs/test.rst | 21 +++++++++++++++++++--
tests/requirements.txt | 7 +++++++
tests/test_sdap.py | 48 +-----------------------------------------------
4 files changed, 28 insertions(+), 50 deletions(-)
diff --git a/docs/release.rst b/docs/release.rst
index c476ecc..f27ba34 100644
--- a/docs/release.rst
+++ b/docs/release.rst
@@ -108,7 +108,7 @@ Verify the images are working by using them in the
:ref:`Quickstart Guide<quicks
Extended Testing
----------------
-Section coming soon...
+:ref`See here for running SDAP tests<test>`.
Vote
====
diff --git a/docs/test.rst b/docs/test.rst
index dcec503..f4c2bbf 100644
--- a/docs/test.rst
+++ b/docs/test.rst
@@ -56,12 +56,29 @@ ingester and RabbitMQ containers and start the webapp
container if it is not alr
Set Up pytest
=============
-TBA
+Before running the tests, you must first set up an environment and install
dependencies:
+
+.. code-block:: bash
+
+ python -m venv env
+ source env/bin/activate
+ pip install -r requirements.txt
Run the Tests!
==============
-TBA
+To execute the tests, simply run
+
+.. code-block:: bash
+
+ pytest --with-integration
+
+You can also target the tests to an SDAP instance running at a different
location, say a remote deployment, but be sure
+it has the required data ingested under the correct collection names,
otherwise most tests will fail.
+
+.. code-block:: bash
+
+ export TEST_HOST=<SDAP URL>
Cleanup
=======
diff --git a/tests/requirements.txt b/tests/requirements.txt
new file mode 100644
index 0000000..8b72872
--- /dev/null
+++ b/tests/requirements.txt
@@ -0,0 +1,7 @@
+pandas
+pytest
+requests
+beautifulsoup4
+python-dateutil
+pytz
+shapely
diff --git a/tests/test_sdap.py b/tests/test_sdap.py
index d27e825..a67e8f0 100644
--- a/tests/test_sdap.py
+++ b/tests/test_sdap.py
@@ -13,11 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import copy
import csv
import datetime
import io
-import itertools
import json
import os
import re
@@ -36,7 +34,6 @@ from bs4 import BeautifulSoup
from dateutil.parser import parse
from geopy.distance import geodesic
from pytz import timezone, UTC
-from requests.exceptions import ConnectTimeout
from shapely import wkt
from shapely.geometry import Polygon, Point
@@ -50,6 +47,7 @@ import cdms_reader
#
#########################
+# TODO: Consider removing old helper methods & fixtures for old CDMS tests
that aren't used here (mainly insitu stuff)
@pytest.fixture(scope="session")
def host():
@@ -775,24 +773,6 @@ def test_subset_L4(host, start, collection):
assert bounding_poly.intersects(Point(float(p['longitude']),
float(p['latitude'])))
assert start <= p['time'] <= end
- # response_buf = io.BytesIO(response.content)
- #
- # with ZipFile(response_buf) as data:
- # namelist = data.namelist()
- #
- # assert namelist == [f'{collection}.csv']
- #
- # csv_buf = io.StringIO(data.read(namelist[0]).decode('utf-8'))
- # csv_data = pd.read_csv(csv_buf)
- #
- # def validate_row_bounds(row):
- # assert bounding_poly.intersects(Point(float(row['longitude']),
float(row['latitude'])))
- # assert params['startTime'] <= row['time'] <= params['endTime']
- #
- # for i in range(0, len(csv_data)):
- # validate_row_bounds(csv_data.iloc[i])
-
-
@pytest.mark.integration
def test_subset_L2(host, start):
url = urljoin(host, 'datainbounds')
@@ -821,24 +801,6 @@ def test_subset_L2(host, start):
assert bounding_poly.intersects(Point(float(p['longitude']),
float(p['latitude'])))
assert start <= p['time'] <= end
- # response_buf = io.BytesIO(response.content)
- #
- # with ZipFile(response_buf) as data:
- # namelist = data.namelist()
- #
- # assert namelist == ['ASCATB-L2-Coastal_test.csv']
- #
- # csv_buf = io.StringIO(data.read(namelist[0]).decode('utf-8'))
- # csv_data = pd.read_csv(csv_buf)
- #
- # def validate_row_bounds(row):
- # assert bounding_poly.intersects(Point(float(row['longitude']),
float(row['latitude'])))
- # assert params['startTime'] <= row['time'] <= params['endTime']
- #
- # for i in range(0, len(csv_data)):
- # validate_row_bounds(csv_data.iloc[i])
-
-
@pytest.mark.integration
def test_timeseries_spark(host, start):
url = urljoin(host, 'timeSeriesSpark')
@@ -1336,11 +1298,3 @@ def test_cdmsresults_netcdf(host, eid, start):
temp_file.close()
warnings.filterwarnings('default')
-
-
-
-
-
-
-
-