diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..cf2ef51 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ + +language: python + +python: + - "3.8" + + +install: pip install -r requirements_dev.txt + +script: pytest \ No newline at end of file diff --git a/requirements_dev.txt b/requirements_dev.txt new file mode 100644 index 0000000..39c67de --- /dev/null +++ b/requirements_dev.txt @@ -0,0 +1,6 @@ +chardet==3.0.4 +pynput==1.6.8 +pyperclip==1.7.0 +python-xlib==0.26 +six==1.14.0 +pytest \ No newline at end of file diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_glib.py b/tests/test_glib.py index c78a21f..274a9b9 100644 --- a/tests/test_glib.py +++ b/tests/test_glib.py @@ -1,45 +1,26 @@ -import unittest -from textscript.glib import * +import pytest +from textscript import glib +def test_check_directory(): + assert not glib.check_directory('fasfbabfabflrfb') + assert glib.check_directory('.github') -class TestGlib(unittest.TestCase): - def test_check_directory(self): +def test_list_subdirectories(): - # Pass tests directory which must exist - result = check_directory('tests') + expected_list = ['./.github', './assets', './tests', './textscript'] + dir_list = glib.list_subdirectories('.') + for dir in expected_list: + assert dir in dir_list - # Assert test directory exists - assert result is True - def test_create_folder(self): +def test_list_files(): - # Test Directory - test_directory = 'tests/test_folder' - # Create Test Directory - create_folder(test_directory) - - # Assert tests/test_folder exists - assert os.path.isdir(test_directory) - - # Delete test_directory - parent_dir = os.getcwd() - delete_dir = os.path.join(parent_dir, test_directory) - os.removedirs(delete_dir) - - def test_list_subdirectories(self): - pass - - def test_list_files(self): - pass - - def test_list_shortcuts(self): - pass - - def test_print_shortcuts(self): - pass - - -if __name__ == '__main__': - unittest.main() + expected_file_names = ['glib.py', 'README.md', '.gitignore', 'pull_request_template.md'] + expected_file_paths = ['./textscript/glib.py', './README.md', './.gitignore', './.github/pull_request_template.md'] + file_list, dir_list = glib.list_files('.') + for file in expected_file_names: + assert file in file_list + for file_path in expected_file_paths: + assert file_path in dir_list \ No newline at end of file diff --git a/textscript/__init__.py b/textscript/__init__.py new file mode 100644 index 0000000..e69de29