Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

38 allow pdf as a valid readme format #48

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions e4e_data_management/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,20 @@ def push(self, path: Path) -> None:
"""
self.active_dataset.check_complete()

# Check that the README is present
readmes = [file
for file in list(self.active_dataset.root.glob('*'))
if re.match(fnmatch.translate('readme.*'), file.name, re.IGNORECASE)]

if len(readmes) == 0:
raise RuntimeError('Readme not found')
acceptable_exts = ['.md', '.docx', '.pdf']
if not any(readme.suffix.lower() in acceptable_exts for readme in readmes):
raise RuntimeError('Illegal README format')

# validate self
self.active_dataset.validate()

# Duplicate to destination
destination = path.joinpath(self.active_dataset.name)
destination.mkdir(parents=True, exist_ok=False)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_push.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def test_push(single_mission_data: Tuple[Tuple[Mock, DataManager, Path], Tuple[P
'README.MD',
'readme.docx',
'readme.DOCX',
'Readme.docx'
'Readme.docx',
'readme.pdf'
])
def test_valid_readme_names(single_mission: Tuple[Mock, DataManager, Path], readme_name: str):
"""Tests valid readme names
Expand Down
Loading