Exemplo n.º 1
0
def test_find_apps():
    from neurotic.integration import find_apps
    import os
    from os.path import dirname, abspath, join

    original_dir = dirname(__file__)

    # scenario 1 - app1/models.py
    scenario1_path = join(join(dirname(__file__), "fixtures"), "proj1")
    assert ["app1"] == list(find_apps(scenario1_path))

    # scenario 2 - app1/models/__init__.py
    scenario2_path = join(join(dirname(__file__), "fixtures"), "proj2")
    assert ["app2"] == list(find_apps(scenario2_path))

    os.chdir(original_dir)
Exemplo n.º 2
0
def django_list_tests(paths):
    from neurotic.integration import (find_settings_module, find_all_tests,
                                      find_apps)
    sys.path.append(os.getcwd())
    sys.path.append(os.path.dirname(os.getcwd()))
    os.environ['DJANGO_SETTINGS_MODULE'] = find_settings_module(os.getcwd())
    names = find_all_tests(find_apps(os.getcwd()))

    for name in names:
        print(name)
Exemplo n.º 3
0
def django_list_tests(paths):
    from neurotic.integration import (find_settings_module, find_all_tests,
                                      find_apps)
    sys.path.append(os.getcwd())
    sys.path.append(os.path.dirname(os.getcwd()))
    os.environ['DJANGO_SETTINGS_MODULE'] = find_settings_module(os.getcwd())
    names = find_all_tests(find_apps(os.getcwd()))

    for name in names:
        print(name)
Exemplo n.º 4
0
import sys
import os
from os.path import dirname, abspath, join

test_path = "/".join(abspath(__file__).split('/')[:-1])
neurotic_path = join(test_path, '../')
sys.path.append(neurotic_path)

from neurotic.integration import find_apps, find_all_tests, find_settings_module

# scenario 2 - app1/tests/__init__.py

scenario2_path = join(test_path, join("fixtures", "proj2"))
sys.path.append(scenario2_path)
os.environ['DJANGO_SETTINGS_MODULE'] = find_settings_module(scenario2_path)
assert ["app2.tests.test_views.DummyTestCase.test_dummy"
        ] == find_all_tests(find_apps(scenario2_path))
print("find_all_isolated_proj2 == OK")
sys.path.remove(scenario2_path)
Exemplo n.º 5
0
import sys
import os
from os.path import dirname, abspath, join

test_path = "/".join(abspath(__file__).split('/')[:-1])
neurotic_path = join(test_path, '../')
sys.path.append(neurotic_path)

from neurotic.integration import find_apps, find_all_tests, find_settings_module

# scenario 2 - app1/tests/__init__.py

scenario2_path = join(test_path, join("fixtures", "proj2"))
sys.path.append(scenario2_path)
os.environ['DJANGO_SETTINGS_MODULE'] = find_settings_module(scenario2_path)
assert ["app2.tests.test_views.DummyTestCase.test_dummy"] == find_all_tests(find_apps(scenario2_path))
print("find_all_isolated_proj2 == OK")
sys.path.remove(scenario2_path)

Exemplo n.º 6
0
import sys
import os
from os.path import dirname, abspath, join

test_path = "/".join(abspath(__file__).split('/')[:-1])
neurotic_path = join(test_path, '../')
sys.path.append(neurotic_path)

from neurotic.integration import find_apps, find_all_tests, find_settings_module

# scenario 2 - app1/tests/__init__.py

scenario3_path = join(test_path, join("fixtures", "proj3"))
sys.path.append(scenario3_path)
os.environ['DJANGO_SETTINGS_MODULE'] = find_settings_module(scenario3_path)
assert [] == find_all_tests(find_apps(scenario3_path))
print("find_all_isolated_proj3 == OK")
sys.path.remove(scenario3_path)

Exemplo n.º 7
0
import os
import sys
from os.path import dirname, abspath, join

test_path = "/".join(abspath(__file__).split('/')[:-1])
neurotic_path = join(test_path, '../')
sys.path.append(neurotic_path)

from neurotic.integration import find_apps, find_all_tests, find_settings_module

# scenario 1 - app1/tests.py

scenario1_path = join(test_path, join("fixtures", "proj1"))
sys.path.append(scenario1_path)
os.environ['DJANGO_SETTINGS_MODULE'] = find_settings_module(scenario1_path)
assert ["app1.tests.DummyTestCase.test_dummy"] == find_all_tests(find_apps(scenario1_path))
print("find_all_isolated_proj1 == OK")
sys.path.remove(scenario1_path)