Skip to content

Commit

Permalink
edited .github/workflows/buildandtestpy~aqsapi.yml to address workflo…
Browse files Browse the repository at this point in the history
…w issues
  • Loading branch information
mccroweyclinton-EPA committed Dec 17, 2024
1 parent 3716766 commit de84467
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 11 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/buildandtestpyaqsapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:

defaults:
run:
shell: bash -leo pipefail {0}
shell: bash -el {0}

jobs:
setup_environment:
Expand All @@ -29,23 +29,17 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: setup environment
uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment.yml
init-shell: >-
bash
powershell
cache-environment: true
environment-name: pyaqsapi
post-cleanup: 'all'
shell: pwsh
shell: bash

- name: Display Python and sphinx version and system info
run: |
Expand Down
2 changes: 1 addition & 1 deletion pyaqsapi/helperfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ def aqs_removeheader(
"""
aqsresult = DataFrame()
for x in enumerate(aqsobject):
for x in range(len(aqsobject)):
aqsresult = concat([aqsresult, aqsobject[x].get_data()], axis=0)

return aqsresult
Expand Down
3 changes: 1 addition & 2 deletions pyaqsapi/metadatafunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,9 @@ def aqs_revisionhistory(
(pandas DataFrame or an AQSAPI_V2 object): Information on the revision
history to the AQS Datamart API.
"""
service = "metaData"
aqsfilter = "revisionHistory"
aqsresult = helperfunctions.AQSAPI_V2()
aqsresult._aqs_metadata_services(service=service, aqsfilter=aqsfilter)
aqsresult._aqs_metadata_services(aqsfilter=aqsfilter)
if return_header:
return aqsresult
else:
Expand Down
38 changes: 38 additions & 0 deletions tests/test_metadatafunctions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from os import environ, getcwd
from os.path import abspath, exists
from sys import path

import pytest

import pyaqsapi.metadatafunctions as metadatafunctions
from pyaqsapi.helperfunctions import aqs_credentials

@pytest.fixture
def setuppyaqsapi(autouse=True):
# print(f"the current working directory is: {getcwd()}")
if exists("./dev/local.py"):
# the following should only execute if the file ./dev/local.py exists
# under the project root folder. This file should not exist on the git
# repostiory or in the final package. local looads the AQS user
# credentials for testing
path.append(abspath("./dev"))
import local

AQSuser, AQSkey = local.setuppyaqsapitest()
aqs_credentials(username=AQSuser, key=AQSkey)
else:
# get the credential information from environment variables if using
# github actions
AQSuser = environ.get("AQSuser")
assert AQSuser is not None
AQSkey = environ.get("AQSkey")
assert AQSkey is not None
aqs_credentials(username=AQSuser, key=AQSkey)


def test_aqs_knownissues(setuppyaqsapi):
assert metadatafunctions.aqs_knownissues(return_header=True).get_status_code() == "200"


def test_aqs_revisionhistory(setuppyaqsapi):
assert metadatafunctions.aqs_revisionhistory(return_header=True).get_status_code() == "200"

0 comments on commit de84467

Please sign in to comment.