Skip to content

Commit b95a393

Browse files
committed
Merge branch 's-master'- Unit testing for moveto method
2 parents e0fcf9f + 0cd4911 commit b95a393

File tree

4 files changed

+46
-14
lines changed

4 files changed

+46
-14
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,4 @@ docs/_build/
5757
# PyBuilder
5858
target/
5959

60+
.idea/

setup.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
21
from setuptools import setup
32

4-
setup(name="classifier",
5-
version="1.6",
6-
description="Classify the files in your Downloads folder into suitable destinations.",
7-
url="http://github.com/bhrigu123/classifier",
8-
author="Bhrigu Srivastava",
9-
author_email="[email protected]",
10-
license='MIT',
11-
packages=["classifier"],
12-
entry_points="""
13-
[console_scripts]
14-
classifier = classifier.classifier:main
15-
""",
3+
setup(
4+
name="classifier",
5+
version="1.6",
6+
description="Classify the files in your Downloads folder into suitable destinations.",
7+
url="http://github.com/bhrigu123/classifier",
8+
author="Bhrigu Srivastava",
9+
author_email="[email protected]",
10+
license='MIT',
11+
packages=["classifier"],
12+
entry_points="""
13+
[console_scripts]
14+
classifier = classifier.classifier:main
15+
""",
1616
install_requires=[
1717
'arrow',
1818
],
19-
zip_safe=False)
19+
zip_safe=False
20+
)

tests/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+

tests/test_classifier.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# -*- coding: utf-8 -*-
2+
3+
import os
4+
import unittest
5+
6+
from classifier import classifier as clf
7+
8+
9+
class ClassifierTest(unittest.TestCase):
10+
11+
__location = os.path.realpath(
12+
os.path.join(os.getcwd(), os.path.dirname(__file__)))
13+
14+
__tmp_file_name = '.classifier_test'
15+
16+
def test_moveto(self):
17+
os.chdir(self.__location)
18+
tmp_file = open(self.__tmp_file_name, 'w')
19+
20+
parent_dir = os.path.abspath(os.path.join(self.__location, os.pardir))
21+
clf.moveto(self.__tmp_file_name, self.__location, parent_dir)
22+
23+
final_file_path = os.path.join(parent_dir, self.__tmp_file_name)
24+
self.assertTrue(os.path.exists(final_file_path))
25+
os.remove(final_file_path)
26+
27+
if __name__ == '__main__':
28+
unittest.main()

0 commit comments

Comments
 (0)