-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d44f7d3
commit fbf7bcc
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: pypi_rocrate | ||
# Validate if rocrate of pypi can open and parse it | ||
# https://pypi.org/project/rocrate/ | ||
|
||
on: [ push ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [ "3.10" ] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install rocrate | ||
- name: Test with pytest | ||
run: | | ||
from zipfile import ZIP_DEFLATED | ||
from zipfile import Path as ZPath | ||
from zipfile import ZipFile | ||
from rocrate.rocrate import ROCrate | ||
from rocrate.model.entity import Entity | ||
from rocrate.model.contextentity import ContextEntity | ||
for fileName in cwd.glob('*.eln'): | ||
print(f'Try to parse: {fileName.name}') | ||
with ZipFile(fileName, 'r', compression=ZIP_DEFLATED) as elnFile: | ||
p = ZPath(elnFile) | ||
dirName = sorted(p.iterdir())[0] | ||
try: | ||
dirpath = Path(tempfile.mkdtemp()) | ||
elnFile.extractall(dirpath) | ||
temppath= dirpath.joinpath(dirName.name) | ||
crate = ROCrate(temppath) | ||
print('\nList content according to https://pypi.org/project/rocrate/') | ||
for e in crate.get_entities(): | ||
print(e.id, e.type) | ||
except ValueError: | ||
print("**ERROR: Could not parse content\n"+traceback.format_exc()+'\n\n') | ||
shell: python | ||
|
||
|