diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2021-05-29 14:54:47 +0100 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2021-05-29 14:54:47 +0100 |
| commit | e727b1c4395e8818a27571e7718e24545309f5c7 (patch) | |
| tree | d3ef1649b01f27590b222c4da4adf999682b03bb /tests/test_utils.py | |
| parent | Bump version and update changelog (diff) | |
| download | paper2remarkable-e727b1c4395e8818a27571e7718e24545309f5c7.tar.gz paper2remarkable-e727b1c4395e8818a27571e7718e24545309f5c7.zip | |
Test and fix uploading multiple files (fixes #110)
Diffstat (limited to 'tests/test_utils.py')
| -rw-r--r-- | tests/test_utils.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_utils.py b/tests/test_utils.py index 4c122e0..903d8b3 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,9 +1,13 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +import os +import tempfile import unittest from paper2remarkable.exceptions import NoPDFToolError + +from paper2remarkable.utils import chdir from paper2remarkable.utils import check_pdftool @@ -16,6 +20,24 @@ class TestUtils(unittest.TestCase): with self.assertRaises(NoPDFToolError): check_pdftool("pdftk_xyz", "qpdf_xyz") + def test_chdir_1(self): + start_dir = os.getcwd() + tmpdir1 = tempfile.mkdtemp(prefix="p2r_test_chdir_") + with chdir(tmpdir1): + pwd = os.getcwd() + self.assertEqual(pwd, tmpdir1) + self.assertEqual(start_dir, os.getcwd()) + + def test_chdir_2(self): + start_dir = os.getcwd() + tmpdir1 = tempfile.mkdtemp(prefix="p2r_test_chdir_") + with self.assertRaises(ValueError): + with chdir(tmpdir1): + pwd = os.getcwd() + raise ValueError + self.assertEqual(pwd, tmpdir1) + self.assertEqual(start_dir, os.getcwd()) + if __name__ == "__main__": unittest.main() |
