Skip to content

Commit d3c7d2d

Browse files
committed
Merge remote-tracking branch 'origin/master' into edge
2 parents fc3456f + b2497bc commit d3c7d2d

File tree

1 file changed

+43
-4
lines changed

1 file changed

+43
-4
lines changed

tests/test_mig_shared_fileio.py

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,56 @@
11
# -*- coding: utf-8 -*-
2+
#
3+
# --- BEGIN_HEADER ---
4+
#
5+
# test_mig_shared_fileio - unit test of the corresponding mig shared module
6+
# Copyright (C) 2003-2024 The MiG Project by the Science HPC Center at UCPH
7+
#
8+
# This file is part of MiG.
9+
#
10+
# MiG is free software: you can redistribute it and/or modify
11+
# it under the terms of the GNU General Public License as published by
12+
# the Free Software Foundation; either version 2 of the License, or
13+
# (at your option) any later version.
14+
#
15+
# MiG is distributed in the hope that it will be useful,
16+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
# GNU General Public License for more details.
19+
#
20+
# You should have received a copy of the GNU General Public License
21+
# along with this program; if not, write to the Free Software
22+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23+
#
24+
# -- END_HEADER ---
25+
#
26+
27+
"""Unit test fileio functions"""
228

329
import binascii
430
import os
531
import sys
632

7-
sys.path.append(os.path.realpath(os.path.join(os.path.dirname(__file__), ".")))
33+
# TODO: remove this as it should not be needed with PYTHONPATH properly set
34+
#sys.path.append(os.path.realpath(os.path.join(os.path.dirname(__file__), ".")))
835

9-
from support import MigTestCase, cleanpath, temppath, testmain
36+
# NOTE: wrap next imports in try except to prevent autopep8 shuffling up
37+
try:
38+
import mig.shared.fileio as fileio
39+
except ImportError as ioe:
40+
print("Failed to import mig core modules: %s" % ioe.message)
41+
exit(1)
42+
43+
# NOTE: prevent autopep8 shuffling next imports up
44+
try:
45+
from support import MigTestCase, cleanpath, temppath, testmain
46+
except ImportError as ioe:
47+
print("Failed to import mig test modules: %s" % ioe.message)
48+
exit(1)
1049

11-
import mig.shared.fileio as fileio
1250

1351
DUMMY_BYTES = binascii.unhexlify('DEADBEEF') # 4 bytes
1452
DUMMY_BYTES_LENGTH = 4
15-
DUMMY_UNICODE = u'UniCode123'
53+
DUMMY_UNICODE = u'UniCode123½¾µßðþđŋħĸþł@ª€£$¥©®'
1654
DUMMY_UNICODE_LENGTH = len(DUMMY_UNICODE)
1755
DUMMY_FILE_WRITECHUNK = 'fileio/write_chunk'
1856
DUMMY_FILE_WRITEFILE = 'fileio/write_file'
@@ -21,6 +59,7 @@
2159

2260

2361
class MigSharedFileio__write_chunk(MigTestCase):
62+
# TODO: Add docstrings to this class and its methods
2463
def setUp(self):
2564
super(MigSharedFileio__write_chunk, self).setUp()
2665
self.tmp_path = temppath(DUMMY_FILE_WRITECHUNK, self, skip_clean=True)

0 commit comments

Comments
 (0)