mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-11 21:53:37 +00:00
31 lines
No EOL
1.1 KiB
Python
31 lines
No EOL
1.1 KiB
Python
import unittest
|
|
|
|
import subprocess
|
|
import os
|
|
|
|
class CompatibilityTests(unittest.TestCase):
|
|
|
|
def test_except(self):
|
|
path = os.path.abspath('..')
|
|
pyfiles = []
|
|
for rootdir in ['sickbeard', 'tests']:
|
|
for dirpath, subdirs, files in os.walk(os.path.join(path, rootdir)):
|
|
for x in files:
|
|
if x.endswith('.py'):
|
|
pyfiles.append(os.path.join(dirpath, x))
|
|
|
|
pyfiles.append(os.path.join(path,'SickBeard.py'))
|
|
|
|
output = subprocess.Popen('2to3'
|
|
' -f except'
|
|
' -f numliterals'
|
|
' %s' % ' '.join(pyfiles), shell=True, stdout=subprocess.PIPE,
|
|
stderr=subprocess.PIPE).communicate()[0]
|
|
if output:
|
|
print('Changes to be made for Python 2/3 compatibility as follows:')
|
|
print(output)
|
|
self.fail('Python 2/3 incompatibility detected')
|
|
|
|
if __name__ == '__main__':
|
|
suite = unittest.TestLoader().loadTestsFromTestCase(QualityTests)
|
|
unittest.TextTestRunner(verbosity=2).run(suite) |