How to use resolve_package method in tox

Best Python code snippet using tox_python

test_session.py

Source: test_session.py Github

copy

Full Screen

...11def test_resolve_pkg_missing_directory(tmpdir, mocksession):12 distshare = tmpdir.join("distshare")13 spec = distshare.join("pkg123-*")14 with pytest.raises(MissingDirectory):15 resolve_package(spec)16def test_resolve_pkg_missing_directory_in_distshare(tmpdir, mocksession):17 distshare = tmpdir.join("distshare")18 spec = distshare.join("pkg123-*")19 distshare.ensure(dir=1)20 with pytest.raises(MissingDependency):21 resolve_package(spec)22def test_resolve_pkg_multiple_valid_versions(tmpdir, mocksession):23 mocksession.logging_levels(quiet=Verbosity.DEFAULT, verbose=Verbosity.DEBUG)24 distshare = tmpdir.join("distshare")25 distshare.ensure("pkg123-1.3.5.zip")26 p = distshare.ensure("pkg123-1.4.5.zip")27 result = resolve_package(distshare.join("pkg123-*"))28 assert result == p29 mocksession.report.expect("info", "determin*pkg123*")30def test_resolve_pkg_with_invalid_version(tmpdir, mocksession):31 distshare = tmpdir.join("distshare")32 distshare.ensure("pkg123-1.something_bad.zip")33 distshare.ensure("pkg123-1.3.5.zip")34 p = distshare.ensure("pkg123-1.4.5.zip")35 result = resolve_package(distshare.join("pkg123-*"))36 mocksession.report.expect("warning", "*1.something_bad*")37 assert result == p38def test_resolve_pkg_with_alpha_version(tmpdir, mocksession):39 distshare = tmpdir.join("distshare")40 distshare.ensure("pkg123-1.3.5.zip")41 distshare.ensure("pkg123-1.4.5a1.tar.gz")42 p = distshare.ensure("pkg123-1.4.5.zip")43 result = resolve_package(distshare.join("pkg123-*"))44 assert result == p45def test_resolve_pkg_doubledash(tmpdir, mocksession):46 distshare = tmpdir.join("distshare")47 p = distshare.ensure("pkg-mine-1.3.0.zip")48 res = resolve_package(distshare.join("pkg-mine*"))49 assert res == p50 distshare.ensure("pkg-mine-1.3.0a1.zip")51 res = resolve_package(distshare.join("pkg-mine*"))52 assert res == p53def test_skip_sdist(cmd, initproj):54 initproj(55 "pkg123-0.7",56 filedefs={57 "tests": {"test_hello.py": "def test_hello(): pass"},58 "setup.py": """59 syntax error60 """,61 "tox.ini": """62 [tox]63 skipsdist=True64 [testenv]65 commands=python -c "print('done')"...

Full Screen

Full Screen

settings.py

Source: settings.py Github

copy

Full Screen

...3"""4import os5import platform6from core.osutils.os_type import OSType7def resolve_package(package_env, default_value):8 package = default_value9 package_env_value = os.getenv(package_env)10 package_env_value_with_dash = os.getenv(package_env.replace("-", "_"))11 if package_env_value is None and package_env_value_with_dash is None:12 print "{0} not set.".format(package_env)13 elif package_env_value is not None:14 if '.tgz' in package_env_value:15 package = package_env_value16 print "{0} tgz package found.".format(package)17 else:18 package = "{0}@{1}".format(package_env, package_env_value)19 print "{0} npm package found.".format(package)20 elif package_env_value_with_dash is not None:21 if '.tgz' in package_env_value_with_dash:22 package = package_env_value_with_dash23 print "{0} tgz package found.".format(package_env_value_with_dash)24 else:25 package = "{0}@{1}".format(package_env, package_env_value_with_dash)26 print "{0} npm package found.".format(package)27 return package28def resolve_path(package_env, default_value):29 package = default_value30 package_env_value = os.environ.get(package_env)31 if package_env_value is None:32 print "{0} not set.".format(package_env)33 elif '.tgz' in package_env_value:34 package = package_env_value35 else:36 # At the moment if we pass nativescript=rc we will still get default path.37 # TODO: Make it more flexible.38 package = default_value39 return package40# Timeout settings (in seconds)41COMMAND_TIMEOUT = 60042# Set current OS43CURRENT_OS = OSType.LINUX44if "Windows" in platform.platform():45 CURRENT_OS = OSType.WINDOWS46if "Darwin" in platform.platform():47 CURRENT_OS = OSType.OSX48# Set test run root folder49TEST_RUN_HOME = os.getcwd()50# Test packages location from env. variables51BASE_PACKAGE_PATH = os.environ.get("BASE_PACKAGE", "Missing")52if "Missing" in BASE_PACKAGE_PATH:53 BASE_PACKAGE_PATH = os.environ.get("BASE_PACKAGE_PATH", "/​tns-dist")54BRANCH = os.environ.get("CLI_PACKAGES_BRANCH", "missing").lower()55if "missing" in BRANCH :56 BRANCH = os.environ.get("BRANCH", "master").lower()57if "release" in BRANCH:58 SHARE_BRANCH = "RC"59 SHARE_BRANCH_INSPECTOR = "RC"60 TAG = "rc"61else:62 SHARE_BRANCH = "Stable"63 SHARE_BRANCH_INSPECTOR = "Master"64 TAG = "next"65# Set source location of separate package based on base path66CLI_PATH = os.environ.get("CLI_PATH", os.path.join(BASE_PACKAGE_PATH, "CLI", SHARE_BRANCH, "nativescript.tgz"))67ANDROID_PATH = os.environ.get("ANDROID_PATH",68 os.path.join(BASE_PACKAGE_PATH, "tns-android", SHARE_BRANCH, "tns-android.tgz"))69IOS_PATH = os.environ.get("IOS_PATH", os.path.join(BASE_PACKAGE_PATH, "tns-ios", SHARE_BRANCH, "tns-ios.tgz"))70TNS_MODULES_PATH = os.environ.get("TNS_MODULES_PATH",71 os.path.join(BASE_PACKAGE_PATH, "tns-modules", SHARE_BRANCH, "tns-core-modules.tgz"))72IOS_INSPECTOR_PATH = os.environ.get("IOS_INSPECTOR_PATH",73 os.path.join(BASE_PACKAGE_PATH, "tns-ios-inspector", SHARE_BRANCH_INSPECTOR,74 "tns-ios-inspector.tgz"))75# Set source location for Preview App packages76PREVIEW_APP_PATH_IOS = os.environ.get("PREVIEW_APP_PATH_IOS", os.path.join(BASE_PACKAGE_PATH, "Playground", "ns-play-dev", "debug", "nsplaydev.tgz"))77PREVIEW_APP_PATH_ANDROID = os.environ.get("PREVIEW_APP_PATH_ANDROID", os.path.join(BASE_PACKAGE_PATH, "Playground", "ns-play-dev", "debug", 'app-universal-release.apk'))78PLAYGROUND_APP_PATH_IOS = os.environ.get("PLAYGROUND_APP_PATH_IOS", os.path.join(BASE_PACKAGE_PATH, "Playground", "ns-play", "debug", "nsplay.tgz"))79PLAYGROUND_APP_PATH_ANDROID = os.environ.get("PLAYGROUND_APP_PATH_ANDROID", os.path.join(BASE_PACKAGE_PATH, "Playground", "ns-play", "debug", "app-release.apk"))80 81# Root folder for local packages82SUT_FOLDER = os.path.join(TEST_RUN_HOME, "sut")83# Set local location of test packages84TNS_PATH = os.path.join("node_modules", ".bin", "tns")85UPDATE_WEBPACK_PATH = os.path.join("node_modules", ".bin", "update-ns-webpack")86ANDROID_PACKAGE = os.path.join(SUT_FOLDER, "tns-android.tgz")87IOS_PACKAGE = os.path.join(SUT_FOLDER, "tns-ios.tgz")88IOS_INSPECTOR_PACKAGE = os.path.join(SUT_FOLDER, "tns-ios-inspector.tgz")89# Respect path variables90CLI_PATH = resolve_path("nativescript", CLI_PATH)91ANDROID_PATH = resolve_path("android", ANDROID_PATH)92IOS_PATH = resolve_path("ios", IOS_PATH)93IOS_INSPECTOR_PATH = resolve_path("ios-inspector", IOS_INSPECTOR_PATH)94WEBPACK_PACKAGE = resolve_package("nativescript-dev-webpack", "nativescript-dev-webpack@next")95SASS_PACKAGE = resolve_package("nativescript-dev-sass", "nativescript-dev-sass@next")96TYPESCRIPT_PACKAGE = resolve_package("nativescript-dev-typescript", "nativescript-dev-typescript@next")97ANGULAR_PACKAGE = resolve_package("nativescript-angular", "nativescript-angular@next")98MODULES_PACKAGE = resolve_package("tns-core-modules", "tns-core-modules@{0}".format(TAG))99# Package manager100USE_YARN = os.environ.get("USE_YARN", "False")101# Output settings102OUTPUT_FOLDER = TEST_RUN_HOME + os.path.sep + "out"103OUTPUT_FILE = os.path.join(OUTPUT_FOLDER, 'output.txt')104OUTPUT_FILE_ASYNC = os.path.join(OUTPUT_FOLDER, 'output_async.txt')105TEST_LOG = os.path.join(OUTPUT_FOLDER, 'testLog.txt')106VERBOSE_LOG = os.path.join(OUTPUT_FOLDER, 'verboseLog.txt')107# Default Simulator and Emulator settings108EMULATOR_NAME = "Emulator-Api23-Default"109EMULATOR_PORT = "5554"110EMULATOR_ID = "emulator-{0}".format(EMULATOR_PORT)111SIMULATOR_NAME = "iPhone7N"112SIMULATOR_TYPE = 'iPhone 7'...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Test Managers in Agile – Creating the Right Culture for Your SQA Team

I was once asked at a testing summit, “How do you manage a QA team using scrum?” After some consideration, I realized it would make a good article, so here I am. Understand that the idea behind developing software in a scrum environment is for development teams to self-organize.

Complete Guide To Styling Forms With CSS Accent Color

The web paradigm has changed considerably over the last few years. Web 2.0, a term coined way back in 1999, was one of the pivotal moments in the history of the Internet. UGC (User Generated Content), ease of use, and interoperability for the end-users were the key pillars of Web 2.0. Consumers who were only consuming content up till now started creating different forms of content (e.g., text, audio, video, etc.).

A Complete Guide To Flutter Testing

Mobile devices and mobile applications – both are booming in the world today. The idea of having the power of a computer in your pocket is revolutionary. As per Statista, mobile accounts for more than half of the web traffic worldwide. Mobile devices (excluding tablets) contributed to 54.4 percent of global website traffic in the fourth quarter of 2021, increasing consistently over the past couple of years.

Webinar: Building Selenium Automation Framework [Voices of Community]

Even though several frameworks are available in the market for automation testing, Selenium is one of the most renowned open-source frameworks used by experts due to its numerous features and benefits.

A Comprehensive Guide On JUnit 5 Extensions

JUnit is one of the most popular unit testing frameworks in the Java ecosystem. The JUnit 5 version (also known as Jupiter) contains many exciting innovations, including support for new features in Java 8 and above. However, many developers still prefer to use the JUnit 4 framework since certain features like parallel execution with JUnit 5 are still in the experimental phase.

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tox automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful