# Path: viceroy/api.py
# def build_test_case(class_name, source_file, scanner_class,
#                     base_class, **extra_attrs):
#     with open(source_file) as fobj:
#         source = fobj.read()
# 
#     scanner = scanner_class(source)
# 
#     test_method_names = set(scanner)
# 
#     attrs = {'viceroy_source_file': source_file}
#     for test_name in test_method_names:
#         full_name = 'test_{}'.format(test_name)
#         attrs[full_name] = test_method_proxy(full_name, test_name)
# 
#     attrs.update(extra_attrs)
# 
#     return type(class_name, (base_class,), attrs)
# 
# Path: viceroy/constants.py
# VICEROY_ROOT = os.path.abspath(os.path.dirname(__file__))
# 
# Path: viceroy/contrib/jasmine.py
# class JasmineScanner(BaseScanner):
#     test_methods = {
#         'it': 0,
#         'xdescribe': stop
#     }
# 
# Path: viceroy/contrib/flask.py
# class ViceroyFlaskTestCase(ViceroyTestCase, TestCase):
#     viceroy_flask_app = None
#     viceroy_flask_port = 5000
#     viceroy_flask_silent = True
# 
#     def _pre_setup(self):
#         pass
# 
#     def _post_teardown(self):
#         pass
# 
#     @classmethod
#     def viceroy_get_flask_app(cls):
#         return cls.viceroy_flask_app
# 
#     @classmethod
#     @contextlib.contextmanager
#     def viceroy_server(cls):
#         app = cls.viceroy_get_flask_app()
#         app.config['TESTING'] = True
#         app.config['VICEROY_TESTING'] = True
#         port = cls.viceroy_flask_port
#         app.config['LIVESERVER_PORT'] = port
#         cls.viceroy_flask_process = None
#         try:
#             cls._start_flask_server(app)
#             yield port
#         finally:
#             cls._stop_flask_server()
# 
#     @classmethod
#     def _start_flask_server(cls, app):
#         cls.viceroy_flask_process = multiprocessing.Process(
#             target=run_app, kwargs={
#                 'app': app,
#                 'port': cls.viceroy_flask_port,
#                 'silent': cls.viceroy_flask_silent
#             }
#         )
#         cls.viceroy_flask_process.start()
#         while not _server_started(cls.viceroy_flask_port):
#             time.sleep(0.01)
# 
#     @classmethod
#     def _stop_flask_server(cls):
#         if cls.viceroy_flask_process is not None:
#             cls.viceroy_flask_process.terminate()
#             cls.viceroy_flask_process.join()


import os
from flask import Flask
from flask import send_from_directory
from flask import send_file
from viceroy.api import build_test_case
from viceroy.constants import VICEROY_ROOT
from viceroy.contrib.jasmine import JasmineScanner
from viceroy.contrib.flask import ViceroyFlaskTestCase
)
JasmineMatchersToBeFalsyTests = build_jasmine_test(
    'core/matchers/toBeFalsySpec.js'
)
JasmineMatchersToBeGreaterThanTests = build_jasmine_test(
    'core/matchers/toBeGreaterThanSpec.js'
)
JasmineMatchersToBeLessThanTests = build_jasmine_test(
    'core/matchers/toBeLessThanSpec.js'
)
JasmineMatcherstoBeNaNTests = build_jasmine_test(
    'core/matchers/toBeNaNSpec.js'
)
JasmineMatchersToBeNullTests = build_jasmine_test(
    'core/matchers/toBeNullSpec.js'
)
JasmineMatchersToBeTests = build_jasmine_test(
    'core/matchers/toBeSpec.js'
)
JasmineMatchersToBeTruthyTests = build_jasmine_test(
    'core/matchers/toBeTruthySpec.js'
)
JasmineMatchersToBeUndefinedTests = build_jasmine_test(
    'core/matchers/toBeUndefinedSpec.js'
)
JasmineMatchersToContainTests = build_jasmine_test(
    'core/matchers/toContainSpec.js'
)
JasmineMatchersToEqualTests = build_jasmine_test(
    'core/matchers/toEqualSpec.js'

# Path: viceroy/api.py
# def build_test_case(class_name, source_file, scanner_class,
#                     base_class, **extra_attrs):
#     with open(source_file) as fobj:
#         source = fobj.read()
# 
#     scanner = scanner_class(source)
# 
#     test_method_names = set(scanner)
# 
#     attrs = {'viceroy_source_file': source_file}
#     for test_name in test_method_names:
#         full_name = 'test_{}'.format(test_name)
#         attrs[full_name] = test_method_proxy(full_name, test_name)
# 
#     attrs.update(extra_attrs)
# 
#     return type(class_name, (base_class,), attrs)
# 
# Path: viceroy/constants.py
# VICEROY_ROOT = os.path.abspath(os.path.dirname(__file__))
# 
# Path: viceroy/contrib/jasmine.py
# class JasmineScanner(BaseScanner):
#     test_methods = {
#         'it': 0,
#         'xdescribe': stop
#     }
# 
# Path: viceroy/contrib/flask.py
# class ViceroyFlaskTestCase(ViceroyTestCase, TestCase):
#     viceroy_flask_app = None
#     viceroy_flask_port = 5000
#     viceroy_flask_silent = True
# 
#     def _pre_setup(self):
#         pass
# 
#     def _post_teardown(self):
#         pass
# 
#     @classmethod
#     def viceroy_get_flask_app(cls):
#         return cls.viceroy_flask_app
# 
#     @classmethod
#     @contextlib.contextmanager
#     def viceroy_server(cls):
#         app = cls.viceroy_get_flask_app()
#         app.config['TESTING'] = True
#         app.config['VICEROY_TESTING'] = True
#         port = cls.viceroy_flask_port
#         app.config['LIVESERVER_PORT'] = port
#         cls.viceroy_flask_process = None
#         try:
#             cls._start_flask_server(app)
#             yield port
#         finally:
#             cls._stop_flask_server()
# 
#     @classmethod
#     def _start_flask_server(cls, app):
#         cls.viceroy_flask_process = multiprocessing.Process(
#             target=run_app, kwargs={
#                 'app': app,
#                 'port': cls.viceroy_flask_port,
#                 'silent': cls.viceroy_flask_silent
#             }
#         )
#         cls.viceroy_flask_process.start()
#         while not _server_started(cls.viceroy_flask_port):
#             time.sleep(0.01)
# 
#     @classmethod
#     def _stop_flask_server(cls):
#         if cls.viceroy_flask_process is not None:
#             cls.viceroy_flask_process.terminate()
#             cls.viceroy_flask_process.join()


# Path: viceroy/tests/test_jasmine.py
import os
from flask import Flask
from flask import send_from_directory
from flask import send_file
from viceroy.api import build_test_case
from viceroy.constants import VICEROY_ROOT
from viceroy.contrib.jasmine import JasmineScanner
from viceroy.contrib.flask import ViceroyFlaskTestCase

)
JasmineMatchersToBeFalsyTests = build_jasmine_test(
    'core/matchers/toBeFalsySpec.js'
)
JasmineMatchersToBeGreaterThanTests = build_jasmine_test(
    'core/matchers/toBeGreaterThanSpec.js'
)
JasmineMatchersToBeLessThanTests = build_jasmine_test(
    'core/matchers/toBeLessThanSpec.js'
)
JasmineMatcherstoBeNaNTests = build_jasmine_test(
    'core/matchers/toBeNaNSpec.js'
)
JasmineMatchersToBeNullTests = build_jasmine_test(
    'core/matchers/toBeNullSpec.js'
)
JasmineMatchersToBeTests = build_jasmine_test(
    'core/matchers/toBeSpec.js'
)
JasmineMatchersToBeTruthyTests = build_jasmine_test(
    'core/matchers/toBeTruthySpec.js'
)
JasmineMatchersToBeUndefinedTests = build_jasmine_test(
    'core/matchers/toBeUndefinedSpec.js'
)
JasmineMatchersToContainTests = build_jasmine_test(
    'core/matchers/toContainSpec.js'
)
JasmineMatchersToEqualTests = build_jasmine_test(
    'core/matchers/toEqualSpec.js'

)