# Path: management/venv.py
# def venv(args,prefix="./"):
#     nargs=[]
#     for a in args:
#         if ' ' in a:
#             nargs.append("'"+a+"'")
#         else:
#             nargs.append(a)
#     cmd = ' '.join(args)
#     local('bash -lic "source '+prefix+'virtual_env/bin/activate && '+cmd+'"')
# 
# Path: management/settings.py
# class settings(object):
#     def __init__(self,package,strip_leading=0):
#         if strip_leading > 0:
#             self._scope = '.'.join(package.split('.')[strip_leading:])
#         else:
#             self._scope = package
# 
#     def default(self, keys):
#         update_default(self._scope,keys)
# 
#     def __getattr__(self, name):
#         return get_key(self._scope,name)
# 
#     def __setattr__(self, name, value):
#         if name == '_scope':
#             super(settings,self).__setattr__(name,value)
#         else:
#             set_key(self._scope,name,value)
#             
#     def __str__(self):
#         s = _settings.get(self._scope,None)
#         return str(s)


from fabric.api import task, local, lcd
from management.venv import venv
from management.settings import settings
import os

conf = settings(__package__, strip_leading=1)

@task
def all():
    cleanup()
    with lcd('tests/selenium/webroot'):
        local('python -m SimpleHTTPServer 7000 2>/dev/null >/dev/null &')
    venv(['PYTHONPATH=./src/:./tests/brython/',
          'python',
          '-m pytest',
          '-rw',
          '--driver PhantomJS',
          '--html tests/results/results.html',
          '--cov=./src/circular',
          '--ignore=./tests/selenium/webroot/',
          '--ignore=./tests/results/',
          'tests'])
    cleanup()

@task
def server():
    cleanup()

# Path: management/venv.py
# def venv(args,prefix="./"):
#     nargs=[]
#     for a in args:
#         if ' ' in a:
#             nargs.append("'"+a+"'")
#         else:
#             nargs.append(a)
#     cmd = ' '.join(args)
#     local('bash -lic "source '+prefix+'virtual_env/bin/activate && '+cmd+'"')
# 
# Path: management/settings.py
# class settings(object):
#     def __init__(self,package,strip_leading=0):
#         if strip_leading > 0:
#             self._scope = '.'.join(package.split('.')[strip_leading:])
#         else:
#             self._scope = package
# 
#     def default(self, keys):
#         update_default(self._scope,keys)
# 
#     def __getattr__(self, name):
#         return get_key(self._scope,name)
# 
#     def __setattr__(self, name, value):
#         if name == '_scope':
#             super(settings,self).__setattr__(name,value)
#         else:
#             set_key(self._scope,name,value)
#             
#     def __str__(self):
#         s = _settings.get(self._scope,None)
#         return str(s)


# Path: management/test/test.py
from fabric.api import task, local, lcd
from management.venv import venv
from management.settings import settings
import os


conf = settings(__package__, strip_leading=1)

@task
def all():
    cleanup()
    with lcd('tests/selenium/webroot'):
        local('python -m SimpleHTTPServer 7000 2>/dev/null >/dev/null &')
    venv(['PYTHONPATH=./src/:./tests/brython/',
          'python',
          '-m pytest',
          '-rw',
          '--driver PhantomJS',
          '--html tests/results/results.html',
          '--cov=./src/circular',
          '--ignore=./tests/selenium/webroot/',
          '--ignore=./tests/results/',
          'tests'])
    cleanup()

@task
def server():
    cleanup()

    venv(['PYTHONPATH=./src/:./tests/brython/ python',