def main():
    if len(sys.argv) > 1:
        addon = sys.argv[1]
    else:
        addon = "fake_addon"
    if len(sys.argv) > 2:
        blender_rev = sys.argv[2]
    else:
        blender_rev = "2.80"

    zipf = zipfile.ZipFile('fake_addon.zip', 'w', zipfile.ZIP_DEFLATED)
    zipdir('./fake_addon', zipf)
    zipf.close()

    here = os.path.dirname(os.path.realpath(__file__))
    config = {"coverage": True, "tests": "advanced_tests/"}

    try:
        exit_val = BAT.test_blender_addon(addon_path=addon,
                                          blender_revision=blender_rev,
                                          config=config)
    except Exception as e:
        print(e)
        exit_val = 1
    sys.exit(exit_val)
def main():
    here = Path(__file__).parent
    if len(sys.argv) > 1:
        addon = sys.argv[1]
    else:
        addon = here.joinpath("fake_addon").as_posix()
    if len(sys.argv) > 2:
        blender_rev = sys.argv[2]
    else:
        blender_rev = "2.80"

    config = {
        "blender_load_tests_script":
        here.joinpath("blender_advanced_load_pytest.py").as_posix(),
        "coverage":
        True,
        "tests":
        here.joinpath("advanced_tests").as_posix()
    }

    try:
        exit_val = BAT.test_blender_addon(addon_path=addon,
                                          blender_revision=blender_rev,
                                          config=config)
    except Exception as e:
        print(e)
        exit_val = 1
    sys.exit(exit_val)
def main():
    here = Path(__file__).parent

    if len(sys.argv) > 1:
        addon = sys.argv[1]
    else:
        addon = here.joinpath("fake_addon").as_posix()
    if len(sys.argv) > 2:
        blender_rev = sys.argv[2]
    else:
        blender_rev = "2.80"

    zipf = zipfile.ZipFile('fake_addon.zip', 'w', zipfile.ZIP_DEFLATED)
    zipdir('./fake_addon', zipf)
    zipf.close()

    config = {
        "coverage": True,
        "tests": here.joinpath("advanced_tests").as_posix()
    }

    try:
        exit_val = BAT.test_blender_addon(addon_path=addon,
                                          blender_revision=blender_rev,
                                          config=config)
    except Exception as e:
        print(e)
        exit_val = 1
    sys.exit(exit_val)
Esempio n. 4
0
def main():    
    if len(sys.argv) > 1:
        addon = sys.argv[1]
    else:
        addon = "fake_addon"
    if len(sys.argv) > 2:
        blender_rev = sys.argv[2]
    else:
        blender_rev = "2.80"
    
    try:
        exit_val = BAT.test_blender_addon(addon_path=addon, blender_revision=blender_rev)
    except Exception as e:
        print(e)
        exit_val = 1
    sys.exit(exit_val)
def main():
    if len(sys.argv) > 1:
        addon = sys.argv[1]
    else:
        addon = Path(__file__).parent.joinpath("fake_addon").as_posix()
    if len(sys.argv) > 2:
        blender_rev = sys.argv[2]
    else:
        blender_rev = "3.2"

    try:
        exit_val = BAT.test_blender_addon(addon_path=addon,
                                          blender_revision=blender_rev)
    except Exception as e:
        print(e)
        exit_val = 1
    sys.exit(exit_val)
Esempio n. 6
0
def main():    
    if len(sys.argv) > 1:
        addon = sys.argv[1]
    else:
        addon = "fake_addon"
    if len(sys.argv) > 2:
        blender_rev = sys.argv[2]
    else:
        blender_rev = "2.80"
    
    here = os.path.dirname(os.path.realpath(__file__))
    config = {"blender_load_tests_script": os.path.join(here, "blender_advanced_load_pytest.py"), "coverage": True, "tests": "advanced_tests/"}

    try:
        exit_val = BAT.test_blender_addon(addon_path=addon, blender_revision=blender_rev, config=config)
    except Exception as e:
        print(e)
        exit_val = 1
    sys.exit(exit_val)
Esempio n. 7
0
def main():
    if len(sys.argv) > 1:
        addon = sys.argv[1]
    else:
        addon = "io_scene_lwo"
    if len(sys.argv) > 2:
        blender_rev = sys.argv[2]
    else:
        blender_rev = "2.93"

    if os.path.isdir("scripts"):
        os.environ["ADDON_TEST_HELPER"] = os.path.join(os.getcwd(), "scripts")
        # This needs to be removed when bug in run_blender is identified
        # This is needed for linux, doesn't seem to work for windows
        sys.path.append(os.environ["ADDON_TEST_HELPER"])

    extra_cmd = "--ignore=tests/lwo_nasa"
    if 'TRAVIS_BRANCH' in os.environ.keys():
        if "master" == os.environ["TRAVIS_BRANCH"] or "develop" == os.environ[
                "TRAVIS_BRANCH"]:
            #if "master" == os.environ["TRAVIS_BRANCH"]:
            extra_cmd = ""


#     config = {"coverage": True}
    config = {"coverage": True, "pytest_args": extra_cmd}
    #     config = {
    #         "coverage": True,
    #         "tests": "tests/basic/test_load_lwo.py",
    #     }
    #     config = {
    #         "coverage": True,
    #         "pytest_args": "--ignore=tests/lwo_nasa",
    #     }
    try:
        exit_val = BAT.test_blender_addon(addon_path=addon,
                                          blender_revision=blender_rev,
                                          config=config)
    except Exception as e:
        print(e)
        exit_val = 1
    sys.exit(exit_val)
import sys

try:
    import blender_addon_tester as BAT
except Exception as e:
    print(e)
    sys.exit(1)

try:
    exit_val = BAT.test_blender_addon(addon_path="pack-shotter",
                                      blender_revision="2.90")
except Exception as e:
    print(e)
    exit_val = 1

sys.exit(exit_val)
    print("{}: [blender_version]".format(sys.argv[0]))
    print(
        "Tests the {} addon archive on blender_version for your OS only (MacOS or Linux)"
        .format(sys.argv[0]))
    print(
        "A pytest coverage report is saved to coverage.xml in the current directory at the end of the test."
    )
    print(
        "If the blender_version argument is not provided. The BLENDER_VERSION environment variable is checked. Else 2.80 is assumed."
    )
    print(
        "This script requires the blender-addon-tester Python module installed first, see requirements.txt or install yourself with pip."
    )


if __name__ == "__main__":
    blender_revision = None
    if len(sys.argv) > 1:
        blender_revision = sys.argv[1]
    else:
        blender_revision = os.environ.get("BLENDER_VERSION", False)
    if not blender_revision:
        print(
            "No blender_revision CLI argument or BLENDER_VERSION environment variable found, defaulting to Blender 2.80 for testing!"
        )
    config = {"coverage": True}

    BAT.test_blender_addon(addon_path=addon_path,
                           blender_revision=blender_revision,
                           config=config)
Esempio n. 10
0
# Setup a local config and script installation environment to not pollute the user's one
os.environ['BLENDER_USER_CONFIG'] = os.path.join(os.environ['BLENDER_CACHE'],
                                                 "local_config_" + args.rev)
if not os.path.exists(os.environ['BLENDER_USER_CONFIG']):
    os.makedirs(os.environ['BLENDER_USER_CONFIG'])

os.environ['BLENDER_USER_SCRIPTS'] = os.path.join(os.environ['BLENDER_CACHE'],
                                                  "local_scripts_" + args.rev)
if not os.path.exists(os.environ['BLENDER_USER_SCRIPTS']):
    os.makedirs(os.environ['BLENDER_USER_SCRIPTS'])

config = {"run_in_window": args.ui, "tests": tests_path}

if args.cov:
    config["coverage"] = args.cov
    config["pytest_args"] = "--cov-config=" + os.path.join(
        script_dir, "coveragerc")
else:
    config["pytest_args"] = "--capture=no" if args.dbg else "-rx"

try:
    exit_value = blender_addon_tester.test_blender_addon(
        addon_path=os.path.abspath(addon_path),
        blender_revision=args.rev,
        config=config)
except Exception as e:
    print(e)
    exit_value = 1

sys.exit(exit_value)