예제 #1
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)
예제 #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)
예제 #3
0
def test_find_settings_module():
    from neurotic.integration import find_settings_module
    import os
    from os.path import dirname, abspath, join

    original_dir = dirname(__file__)

    # scenario 1 - current_dir/settings.py
    scenario1_path = join(join(dirname(__file__), "fixtures"), "proj1")
    assert "settings" == find_settings_module(scenario1_path)

    # scenario 2 - current_dir/django_prod/settings.py
    scenario2_path = join(join(dirname(__file__), "fixtures"), "proj2")
    assert "django_proj.settings" == find_settings_module(scenario2_path)

    # scenario 3 - current_dir/django_prod/settings/__int__.py
    scenario3_path = join(join(dirname(__file__), "fixtures"), "proj3")
    assert "django_proj.settings" == find_settings_module(scenario3_path)

    with pytest.raises(Exception):
        find_settings_module(original_dir)

    os.chdir(original_dir)
예제 #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)
예제 #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)