예제 #1
0
)

os.environ["DJANGAE_APP_YAML_LOCATION"] = os.path.join(BASE_DIR, "fluent")

args = [sys.argv[0], 'test']

# Current module (``tests``) and its submodules.
test_cases = '.'

# Allow accessing test options from the command line.
offset = 1
try:
    sys.argv[1]
except IndexError:
    pass
else:
    option = sys.argv[1].startswith('-')
    if not option:
        test_cases = sys.argv[1]
        offset = 2

args.append(test_cases)
# ``verbosity`` can be overwritten from command line.
args.append('--verbosity=2')
args.append('--nomigrations')
args.extend(sys.argv[offset:])

from djangae.core.management import test_execute_from_command_line

test_execute_from_command_line(args)
예제 #2
0
#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE",
                          "{{ cookiecutter.name }}.settings")
    try:
        from djangae.core.management import execute_from_command_line, test_execute_from_command_line
    except ImportError:
        # The above import may fail for some other reason. Ensure that the
        # issue is really that Django is missing to avoid masking other
        # exceptions on Python 2.
        try:
            import django
        except ImportError:
            raise ImportError(
                "Couldn't import Django. Are you sure it's installed and "
                "available on your PYTHONPATH environment variable? Did you "
                "forget to activate a virtual environment?")
        raise
    if "test" in sys.argv:
        test_execute_from_command_line(sys.argv)
    else:
        execute_from_command_line(sys.argv)
예제 #3
0
#!/usr/bin/env python
import logging
import os
import sys

if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "testapp.settings")

    from fix_path import fix_path
    fix_path()

    from djangae.core.management import execute_from_command_line, test_execute_from_command_line

    if "test" in sys.argv:
        logging.disable(logging.CRITICAL)
        test_execute_from_command_line(sys.argv)
    else:
        execute_from_command_line(sys.argv)