20 lines
750 B
Python
20 lines
750 B
Python
|
# -*- coding: utf-8 -*-
|
||
|
from __future__ import unicode_literals
|
||
|
|
||
|
from os import listdir, path
|
||
|
import re
|
||
|
|
||
|
|
||
|
def test_fxcker_files_py2_compatibility():
|
||
|
dir = path.join('.', 'librefi', 'fxckers')
|
||
|
fxckers = listdir(dir)
|
||
|
for fxcker in fxckers:
|
||
|
if re.match(r'^\w+\.py$', fxcker):
|
||
|
with open(path.join(dir, fxcker), 'r') as file:
|
||
|
content = file.read()
|
||
|
if re.match(r'^(#!.+\r?\n)?\s*(# (-\*- )?coding: utf-8( -\*-)?\r?\n)?\s*(from __future__ import (\w+, )*unicode_literals)',
|
||
|
content) is None:
|
||
|
print(content)
|
||
|
print(fxcker)
|
||
|
raise AssertionError('fxcker %s not containing required compat imports' % (fxcker))
|