Browse Source

Removed outdated code

pull/150/head
chriskiehl 8 years ago
parent
commit
efbea19c13
2 changed files with 0 additions and 44 deletions
  1. 28
      gooey/python_bindings/modules.py
  2. 16
      gooey/tests/modules_unittest.py

28
gooey/python_bindings/modules.py

@ -1,28 +0,0 @@
import os
import time
import hashlib
from itertools import dropwhile
import sys
import tempfile
sys.path.append(os.path.dirname(__file__))
def load(module_source):
descriptor, tmpfilepath = tempfile.mkstemp(suffix='.py')
tmpfiledir = os.path.dirname(tmpfilepath)
tmpfilename = os.path.splitext(os.path.split(tmpfilepath)[-1])[0]
sys.path.append(tmpfiledir)
try:
with open(tmpfilepath, 'w') as f:
f.write(module_source)
return __import__(tmpfilename)
finally:
os.close(descriptor)
os.remove(tmpfilepath)
if __name__ == '__main__':
pass

16
gooey/tests/modules_unittest.py

@ -1,16 +0,0 @@
from gooey.python_bindings import modules
module_source = \
'''
some_var = 1234
def fooey():
return 10
'''
def test_load_creates_and_imports_module_from_string_source():
module = modules.load(module_source)
assert 10 == module.fooey()
Loading…
Cancel
Save