diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_taskipy.py | 2 | ||||
| -rw-r--r-- | tests/test_windows.py | 26 | ||||
| -rw-r--r-- | tests/test_windows_sanity.py | 11 | ||||
| -rw-r--r-- | tests/utils/project.py | 2 |
4 files changed, 28 insertions, 13 deletions
diff --git a/tests/test_taskipy.py b/tests/test_taskipy.py index 84b767a..1598f0f 100644 --- a/tests/test_taskipy.py +++ b/tests/test_taskipy.py @@ -76,7 +76,7 @@ class RunTaskTestCase(TaskipyTestCase): cwd = self.create_test_dir_from_fixture('project_with_pyproject_and_tasks') self.run_task('create_hello_txt', cwd=cwd) - with open(path.join(cwd, 'hello.txt'), 'r') as f: + with open(path.join(cwd, 'hello.txt'), 'r', encoding='utf-8') as f: hello_file_contents = f.readline().strip() self.assertEqual(hello_file_contents, 'hello, world') diff --git a/tests/test_windows.py b/tests/test_windows.py new file mode 100644 index 0000000..78ba69f --- /dev/null +++ b/tests/test_windows.py @@ -0,0 +1,26 @@ +import platform + +import unittest + + +@unittest.skipIf(platform.system() != 'Windows', 'Windows only tests') +class WindowsTestCase(unittest.TestCase): + def test_windows_path_sanity(self): + ''' + This test case is a no-op, and exists only to ensure that windows paths work + as part of the windows sanity ci test. + ''' + print('sanity passed - test was run') + + def test_mslex_install(self): + '''Ensure that mslex is installed on Windows''' + try: + import mslex # type: ignore # pylint: disable=W0611,C0415 + except ImportError: + self.fail('Unable to import mslex') + + def test_mslex_import(self): + '''Ensure that mslex is used as shlex''' + from taskipy.task_runner import shlex # pylint: disable=C0415 + + self.assertEqual(shlex.__name__, 'mslex') diff --git a/tests/test_windows_sanity.py b/tests/test_windows_sanity.py deleted file mode 100644 index 0b7dc55..0000000 --- a/tests/test_windows_sanity.py +++ /dev/null @@ -1,11 +0,0 @@ -import unittest - - -class WindowsSanityTestCase(unittest.TestCase): - ''' - This test case is a no-op, and exists only to ensure that windows paths work - as part of the windows sanity ci test. - ''' - - def test_windows_sanity(self): - print('sanity passed - test was run') diff --git a/tests/utils/project.py b/tests/utils/project.py index d6c151b..8df135a 100644 --- a/tests/utils/project.py +++ b/tests/utils/project.py @@ -24,7 +24,7 @@ class GenerateProjectWithPyProjectToml(ProjectDirGenerator): def generate_project(self, temp_dir: str): os.makedirs(temp_dir) - with open(path.join(temp_dir, 'pyproject.toml'), 'w') as f: + with open(path.join(temp_dir, 'pyproject.toml'), 'w', encoding='utf-8') as f: f.write(self._py_project_toml) |