Skip to content

Commit 5568a10

Browse files
committed
fix: unit tests
1 parent 9853f7e commit 5568a10

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ before_install:
66
- pip install -U pip
77
install:
88
- ls ~/
9-
- sudo apt install tesseract-ocr
10-
- sudo apt install libtesseract-dev
9+
- sudo apt-get update
10+
- sudo apt-get install tesseract-ocr
11+
- sudo apt-get install libtesseract-dev
1112
- python -m pip install --upgrade pip
1213
- pip install --upgrade -r requirements.txt
1314
script:

core_tests/utils/run_tests.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import os
2-
import time
32
import unittest
4-
from os.path import expanduser
53

4+
import time
65
from nose.tools import timed
76

87
from core.settings import Settings
@@ -13,29 +12,28 @@
1312

1413
# noinspection PyMethodMayBeStatic
1514
class RunTests(unittest.TestCase):
15+
current_folder = os.path.dirname(os.path.realpath(__file__))
1616

1717
def tearDown(self):
1818
Process.kill_all_in_context()
1919

2020
def test_01_run_simple_command(self):
21-
home = expanduser("~")
22-
result = run(cmd='ls ' + home, wait=True, timeout=1)
21+
result = run(cmd='ls ' + self.current_folder, wait=True, timeout=1)
2322
assert result.exit_code == 0, 'Wrong exit code of successful command.'
2423
assert result.log_file is None, 'No log file should be generated if wait=True.'
2524
assert result.complete is True, 'Complete should be true when process execution is complete.'
2625
assert result.duration < 1, 'Process duration took too much time.'
27-
assert 'Desktop' in result.output, 'Listing home do not include Desktop folder.'
26+
assert 'run_tests.py' in result.output, 'Listing do not return correct output.'
2827

2928
def test_02_run_command_with_redirect(self):
30-
home = expanduser("~")
3129
out_file = os.path.join(Settings.TEST_OUT_HOME, 'log.txt')
32-
result = run(cmd='ls ' + home + ' > ' + out_file, wait=True, timeout=1)
30+
result = run(cmd='ls ' + self.current_folder + ' > ' + out_file, wait=True, timeout=1)
3331
assert result.exit_code == 0, 'Wrong exit code of successful command.'
3432
assert result.log_file is None, 'No log file should be generated if wait=True.'
3533
assert result.complete is True, 'Complete should be true when process execution is complete.'
3634
assert result.duration < 1, 'Process duration took too much time.'
3735
assert result.output == '', 'Output should be empty.'
38-
assert 'Desktop' in File.read(path=out_file)
36+
assert 'run_tests.py' in File.read(path=out_file)
3937

4038
def test_03_run_command_with_pipe(self):
4139
result = run(cmd='echo "test case" | wc -w ', wait=True, timeout=1)

0 commit comments

Comments
 (0)