Пример #1
0
 def test_return_code(self):
     # 0: match found or help/version printed
     # 1: no match
     # 2: error
     sys.stdout = StringIO()  # help is not printed through output_formatter
     sys.stderr = StringIO()  # errors by optparse go here
     try:
         for args, expected in [(['--help'], 0),
                                (['--version'], 0),
                                ([], 0),  # prints help
                                (['abc', self.testdir1], 0),
                                (['--py', 'abc', self.testdir1], 1),
                                (['no match here', self.testdir1], 1),
                                (['--invalid'], 2),
                                ([['invalid arg causes error']], 2)]:
             rc = main(['pss'] + args, output_formatter=self.of)
             self.assertEquals(rc, expected)
     finally:
         sys.stdout = sys.__stdout__
         sys.stderr = sys.__stderr__
Пример #2
0
 def test_return_code(self):
     # 0: match found or help/version printed
     # 1: no match
     # 2: error
     sys.stdout = StringIO()  # help is not printed through output_formatter
     sys.stderr = StringIO()  # errors by optparse go here
     try:
         for args, expected in [
             (['--help'], 0),
             (['--version'], 0),
             ([], 0),  # prints help
             (['abc', self.testdir1], 0),
             (['--py', 'abc', self.testdir1], 1),
             (['no match here', self.testdir1], 1),
             (['--invalid'], 2),
             ([['invalid arg causes error']], 2)
         ]:
             rc = main(['pss'] + args, output_formatter=self.of)
             self.assertEquals(rc, expected)
     finally:
         sys.stdout = sys.__stdout__
         sys.stderr = sys.__stderr__
Пример #3
0
def cherche(mot):
	# exclude all strings of keys
	pss.main(['']+['.*?:.*?'+mot, "--json", "/data/audio/"], output_formatter=of)
	return of.output
Пример #4
0
 def _run_main(self, args, dir=None, output_formatter=None, expected_rc=0):
     rc = main(argv=[''] + args + [dir or self.testdir1],
               output_formatter=output_formatter or self.of)
     self.assertEqual(rc, expected_rc)
Пример #5
0
 def _run_main(self, args, dir=None, output_formatter=None, expected_rc=0):
     rc = main(
         argv=[''] + args + [dir or self.testdir1],
         output_formatter=output_formatter or self.of)
     self.assertEquals(rc, expected_rc)
Пример #6
0
#!/usr/bin/env python
# Used for direct invocation of this directory by python, without actually
# having to install pss

from psslib.pss import main; main()

Пример #7
0
 def _run_main(self, args, dir=None, output_formatter=None):
     main(
         argv=[''] + args + [dir or self.testdir1],
         output_formatter=output_formatter or self.of)
Пример #8
0
#!/usr/bin/env python
import sys
from psslib.pss import main

sys.exit(main())
Пример #9
0
Файл: pss.py Проект: pfmoore/pss
#!/usr/bin/env python
from psslib.pss import main; main()

Пример #10
0
#!/usr/bin/env python
import sys
from psslib.pss import main
sys.exit(main())
Пример #11
0
 def _run_main(self, args, dir=None, output_formatter=None):
     main(argv=[''] + args + [dir or self.testdir1],
          output_formatter=output_formatter or self.of)