No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

utils.py 718B

12345678910111213141516171819202122232425262728293031
  1. import tempfile
  2. import shutil
  3. import sys
  4. from EditorialModel.model import Model
  5. import leapi
  6. from EditorialModel.backend.json_backend import EmBackendJson
  7. from DataSource.MySQL.leapidatasource import DummyDatasource
  8. from leapi.lefactory import LeFactory
  9. genepy_args = {
  10. 'model' : Model(EmBackendJson(json_file = 'EditorialModel/test/me.json')),
  11. 'datasource_cls': DummyDatasource,
  12. 'datasource_args': {}
  13. }
  14. def tmp_load_factory_code(name='dyncode'):
  15. tmpdir = tempfile.mkdtemp('_lodel2_test_dyncode')
  16. fname = tmpdir+'/%s.py'%name
  17. sys.path.append(tmpdir)
  18. fact = LeFactory(fname)
  19. fact.create_pyfile(**genepy_args)
  20. return tmpdir
  21. def cleanup(tmpdir):
  22. shutil.rmtree(tmpdir)