Skip to content

Commit

Permalink
Fixed push logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ntlhui committed Mar 3, 2023
1 parent aab709c commit 1a69927
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion e4e_data_management/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ def push(self, path: Path) -> None:
raise RuntimeError('Files still in staging')

# Check that the README is present
readmes = self.active_dataset.root.glob('readme.*')
readmes = list(self.active_dataset.root.glob('readme.*'))
if len(readmes) == 0:
raise RuntimeError('Readme not found')
acceptable_exts = ['.md', '.docx']
if any(readme.suffix.lower() not in acceptable_exts for readme in readmes):
raise RuntimeError('Illegal README format')
Expand Down
8 changes: 4 additions & 4 deletions tests/test_push.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def test_push(single_mission_data: Tuple[Tuple[Mock, DataManager, Path], Tuple[P
test_app, _ = single_mission_data
_, app, _ = test_app

app.add([test_readme])
app.commit()
app.add([test_readme], readme=True)
app.commit(readme=True)
with TemporaryDirectory() as push_dir:
push_path = Path(push_dir)
app.push(push_path)
Expand Down Expand Up @@ -51,8 +51,8 @@ def test_valid_readme_names(single_mission: Tuple[Mock, DataManager, Path], read
readme_path = Path(data_dir).joinpath(readme_name)
with open(readme_path, 'w', encoding='ascii') as handle:
handle.write('readme\n')
app.add([readme_path])
app.commit()
app.add([readme_path], readme=True)
app.commit(readme=True)

with TemporaryDirectory() as push_dir:
push_path = Path(push_dir)
Expand Down

0 comments on commit 1a69927

Please sign in to comment.