Skip to content

Commit

Permalink
fix gh action
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasprobst committed Apr 7, 2024
1 parent adc6adf commit 65e0476
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 8 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,36 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml

- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-
zenodo_cleanup:
runs-on: windows-latest
python-version: '3.8'

steps:

- name: Checkout repo
uses: actions/checkout@v3

- name: Cleanup Zenodo Sandbox
run: python tests/clean_zenodo_sandbox.py

- name: Set Up Python python38
uses: actions/setup-python@v3
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools
pip install -r requirements-dev.txt
- name: Cleanup Zenodo Sandbox
run: python tests/clean_zenodo_sandbox.py
10 changes: 5 additions & 5 deletions h5rdmtoolbox/repository/zenodo/tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ def get_api_token(sandbox: bool,
"""Read the Zenodo API token from the config file."""
if sandbox:
env_token = os.environ.get('ZENODO_SANDBOX_API_TOKEN', None)
logger.debug('Took token from environment variable ZENODO_SANDBOX_API_TOKEN: %s', env_token)
# logger.debug('Took token from environment variable ZENODO_SANDBOX_API_TOKEN: %s', env_token)
else:
env_token = os.environ.get('ZENODO_API_TOKEN', None)
logger.debug('Took token from environment variable ZENODO_API_TOKEN: %s', env_token)
# logger.debug('Took token from environment variable ZENODO_API_TOKEN: %s', env_token)

if env_token is not None:
logger.debug('Took zenodo token from environment variable:: %s', env_token)
# logger.debug('Took zenodo token from environment variable:: %s', env_token)
env_token = env_token.strip()
logger.debug('Took token from environment variable ZENODO_SANDBOX_API_TOKEN.')
logger.debug(' Took token from environment variable ZENODO_SANDBOX_API_TOKEN.')
return env_token

logger.debug('No environment variable found for the zenodo token. Trying to read it from the config file '
'%s .' % zenodo_ini_filename)
print(env_token)

zenodo_ini_filename = _parse_ini_file(zenodo_ini_filename)
config = configparser.ConfigParser()
config.read(zenodo_ini_filename)
Expand Down
6 changes: 3 additions & 3 deletions tests/repository/test_zenodo.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def hdf2json(hdf_filename: pathlib.Path) -> pathlib.Path:
# '__h5rdmtoolbox_version__': h5tbx.__version__
# }
# )
z.delete()
# z.delete()

def test_ZenodoSandboxDeposit(self):
z = zenodo.ZenodoSandboxDeposit(None)
Expand All @@ -285,7 +285,7 @@ def test_ZenodoSandboxDeposit(self):

old_rec_id = z.rec_id

z.delete()
# z.delete()

with self.assertRaises(ValueError):
_ = zenodo.ZenodoSandboxDeposit(old_rec_id)
Expand Down Expand Up @@ -370,5 +370,5 @@ def test_ZenodoSandboxDeposit(self):
self.assertEqual(len(hdf_and_txt_filenames), 1)
self.assertEqual(hdf_and_txt_filenames[0].suffix, '.txt')

z.delete()
# z.delete()
self.assertFalse(z.exists())

0 comments on commit 65e0476

Please sign in to comment.