File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+ # coding:utf8
3+
4+ import sys
5+ import os
6+ import unittest
7+ from unittest .mock import patch
8+ from code_counter .__main__ import main
9+
10+ test_path = os .path .abspath ('.' )
11+ bin_path = os .path .dirname (os .path .join (os .pardir , '..' ))
12+ lib_path = os .path .abspath (os .path .join (bin_path , 'code_counter' ))
13+ app_path = os .path .join (lib_path , '__main__.py' )
14+
15+
16+ class CodeCounterRemoteTest (unittest .TestCase ):
17+ @patch ('builtins.input' )
18+ def test_remote_case1 (self , mock_input ):
19+ mock_input .side_effect = ['' ]
20+ options = ['python' , app_path ,
21+ 'remote' ,
22+ 'https://github.com/innofang/code-counter.git' ,
23+ '-v' ,
24+ '-o=output.txt' ]
25+ sys .argv [1 :] = options [2 :]
26+ try :
27+ main ()
28+ except :
29+ print ('Occur Error!' )
30+
31+ output_path = os .path .join (test_path , 'output.txt' )
32+ self .assertTrue (os .path .exists (output_path ))
33+ os .remove (output_path )
You can’t perform that action at this time.
0 commit comments