Skip to content
Snippets Groups Projects
Commit 3805c815 authored by Hock, Martin's avatar Hock, Martin
Browse files

Merge branch 'bugfix-#51' into 'dev'

Allow publishing data to a directory with trailing slash.

See merge request !20
parents 3825f198 a9b0723d
No related branches found
No related tags found
7 merge requests!41Include latest changes in main branch,!37Merge dev upstream changes into improve/metadata,!34Include architecture diagram in docs,!32SAST implementation,!27Update documentation and version number,!26Merge !23, !24, !25 into main,!20Allow publishing data to a directory with trailing slash.
Pipeline #786965 passed
......@@ -56,5 +56,5 @@ IMGS_AS_LIST = [IMG1, IMG2]
# plots or images.
publish(['../README.md', '../docs', '../LICENSE'],
'/home/chief/Dokumente/fst/plotid_python/data',
'/home/chief/Dokumente/fst/plotid_python/data/',
TAGGED_FIGS, 'Bild')
......@@ -55,6 +55,13 @@ class PublishOptions:
self.data_storage = data_storage
self.dst_path_head, self.dst_dirname = os.path.split(self.dst_path)
# If the second string after os.path.split is empty,
# a trailing slash was given.
# To get the dir name correctly, split the first string again.
if not self.dst_dirname:
self.dst_path_head, self.dst_dirname = os.path.split(
self.dst_path_head)
def validate_input(self):
"""
Validate if input for PublishOptions is correct type.
......
......@@ -46,7 +46,7 @@ class TestPublish(unittest.TestCase):
'copied.')
def test_publish(self):
""" Test publish and check if an exported picture file exists. """
publish(SRC_DIR, DST_PATH, FIG, PIC_NAME, 'individual')
publish(SRC_DIR, DST_PATH + '/', FIG, PIC_NAME, 'individual')
assert os.path.isfile(os.path.join(DST_PATH, PIC_NAME + '.png'))
# Skip test if tests are run from command line.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment