py2.7c: test fxckers for basic py2.7 compatibility
parent
1f9cf6839f
commit
c93f42fa9a
|
@ -1,3 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from ._map import fxckers_map
|
||||
|
||||
__all__ = ['fxckers_map']
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
# -*- 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))
|
Loading…
Reference in New Issue