|
1 | 1 | # -*- 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""" |
2 | 28 |
|
3 | 29 | import binascii
|
4 | 30 | import os
|
5 | 31 | import sys
|
6 | 32 |
|
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__), "."))) |
8 | 35 |
|
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) |
10 | 49 |
|
11 |
| -import mig.shared.fileio as fileio |
12 | 50 |
|
13 | 51 | DUMMY_BYTES = binascii.unhexlify('DEADBEEF') # 4 bytes
|
14 | 52 | DUMMY_BYTES_LENGTH = 4
|
15 |
| -DUMMY_UNICODE = u'UniCode123' |
| 53 | +DUMMY_UNICODE = u'UniCode123½¾µßðþđŋħĸþł@ª€£$¥©®' |
16 | 54 | DUMMY_UNICODE_LENGTH = len(DUMMY_UNICODE)
|
17 | 55 | DUMMY_FILE_WRITECHUNK = 'fileio/write_chunk'
|
18 | 56 | DUMMY_FILE_WRITEFILE = 'fileio/write_file'
|
|
21 | 59 |
|
22 | 60 |
|
23 | 61 | class MigSharedFileio__write_chunk(MigTestCase):
|
| 62 | + # TODO: Add docstrings to this class and its methods |
24 | 63 | def setUp(self):
|
25 | 64 | super(MigSharedFileio__write_chunk, self).setUp()
|
26 | 65 | self.tmp_path = temppath(DUMMY_FILE_WRITECHUNK, self, skip_clean=True)
|
|
0 commit comments