File tree Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Original file line number Diff line number Diff line change 1
1
language : python
2
2
python :
3
3
- " 2.7"
4
+ node_js : 10
5
+ before_install :
6
+ - pip install -U pip
4
7
install :
5
- - sudo apt-get install tesseract-ocr-eng
8
+ - ls ~/
9
+ - sudo apt install tesseract-ocr
10
+ - sudo apt install libtesseract-dev
6
11
- python -m pip install --upgrade pip
7
12
- pip install --upgrade -r requirements.txt
8
13
script :
Original file line number Diff line number Diff line change 1
- import time
2
1
import unittest
3
2
3
+ import time
4
+
5
+ from core .enums .os_type import OSType
6
+ from core .settings import Settings
4
7
from core .utils .process import Process
5
8
from core .utils .run import run
6
9
7
10
8
11
class ProcessTests (unittest .TestCase ):
12
+ if Settings .HOST_OS == OSType .WINDOWS :
13
+ http_module = 'http.server'
14
+ else :
15
+ http_module = 'SimpleHTTPServer'
9
16
10
17
def test_30_kill_by_port (self ):
11
18
port = 4210
12
19
self .start_server (port = port )
13
20
time .sleep (0.5 )
14
- running = Process .is_running_by_commandline (commandline = 'http.server' )
21
+ running = Process .is_running_by_commandline (commandline = self . http_module )
15
22
assert running , 'Failed to start simple http server.'
16
23
Process .kill_by_port (port = port )
17
24
time .sleep (0.5 )
18
- running = Process .is_running_by_commandline (commandline = 'http.server' )
25
+ running = Process .is_running_by_commandline (commandline = self . http_module )
19
26
assert not running , 'Kill by port failed to kill process.'
20
27
21
- @staticmethod
22
- def start_server (port ):
23
- run (cmd = 'python -m http.server ' + str (port ), wait = False )
28
+ def start_server (self , port ):
29
+ run (cmd = 'python -m {0} {1}' .format (self .http_module , str (port )), wait = False )
24
30
25
31
26
32
if __name__ == '__main__' :
You can’t perform that action at this time.
0 commit comments