From 698ef8cdd277449bc17dcce8813e87cd54eb73fc Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Fri, 30 Oct 2020 16:35:31 +0800 Subject: [PATCH] improve test performance --- .azure-pipelines/steps/run-tests-linux.yml | 2 +- .azure-pipelines/steps/run-tests-windows.yml | 2 +- .github/workflows/ci.yaml | 2 +- setup.cfg | 3 +-- tests/integration/conftest.py | 2 +- tests/integration/test_install_twists.py | 3 +-- tests/integration/test_install_uri.py | 20 +++++++++----------- 7 files changed, 15 insertions(+), 19 deletions(-) diff --git a/.azure-pipelines/steps/run-tests-linux.yml b/.azure-pipelines/steps/run-tests-linux.yml index efeda02a..914d1bac 100644 --- a/.azure-pipelines/steps/run-tests-linux.yml +++ b/.azure-pipelines/steps/run-tests-linux.yml @@ -21,7 +21,7 @@ steps: # Fix Git SSL errors echo "Using pipenv python version: $(PIPENV_DEFAULT_PYTHON_VERSION)" git submodule sync && git submodule update --init --recursive - pipenv run pytest -n 4 --junitxml=junit/test-results.xml --timeout=300 tests + pipenv run pytest -n 4 --junitxml=junit/test-results.xml tests displayName: Run integration tests env: PYTHONWARNINGS: ignore:DEPRECATION diff --git a/.azure-pipelines/steps/run-tests-windows.yml b/.azure-pipelines/steps/run-tests-windows.yml index d8e31b30..34c4f772 100644 --- a/.azure-pipelines/steps/run-tests-windows.yml +++ b/.azure-pipelines/steps/run-tests-windows.yml @@ -46,7 +46,7 @@ steps: - script: | git submodule sync git submodule update --init --recursive - pipenv run pytest -ra -n 4 --junit-xml=junit/test-results.xml --timeout=300 tests/ + pipenv run pytest -ra -n 4 --junit-xml=junit/test-results.xml tests/ failOnStderr: false displayName: Run integration tests env: diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 94d8088a..e492aa9d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -80,4 +80,4 @@ jobs: PYTHONIOENCODING: 'utf-8' GIT_SSH_COMMAND: ssh -o StrictHostKeyChecking=accept-new -o CheckHostIP=no run: | - pipenv run pytest -ra -n 4 --timeout=300 tests + pipenv run pytest -ra -n 4 tests diff --git a/setup.cfg b/setup.cfg index f45c0d05..1a6e415e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -41,8 +41,7 @@ python_version=3.6 mypy_path=typeshed/pyi:typeshed/imports [tool:pytest] -addopts = -ra -n auto -plugins = xdist +addopts = -ra testpaths = tests ; Add vendor and patched in addition to the default list of ignored dirs ; Additionally, ignore tasks, news, test subdirectories and peeps directory diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 710c9644..20374e01 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -69,7 +69,7 @@ def check_github_ssh(): # GitHub does not provide shell access.' if ssh keys are available and # registered with GitHub. Otherwise, the command will fail with # return_code=255 and say 'Permission denied (publickey).' - c = delegator.run('ssh -o StrictHostKeyChecking=accept-new -o CheckHostIP=no -T git@github.com', timeout=30) + c = delegator.run('ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -T git@github.com', timeout=30) res = True if c.return_code == 1 else False except KeyboardInterrupt: warnings.warn( diff --git a/tests/integration/test_install_twists.py b/tests/integration/test_install_twists.py index 2ee5b5d2..79396fa6 100644 --- a/tests/integration/test_install_twists.py +++ b/tests/integration/test_install_twists.py @@ -360,8 +360,7 @@ def test_multiple_editable_packages_should_not_race(PipenvInstance, testsroot): with PipenvInstance(chdir=True) as p: for pkg_name in pkgs: source_path = p._pipfile.get_fixture_path("git/{0}/".format(pkg_name)).as_posix() - c = delegator.run("git clone {0} ./{1}".format(source_path, pkg_name)) - assert c.return_code == 0 + shutil.copytree(source_path, pkg_name) pipfile_string += '"{0}" = {{path = "./{0}", editable = true}}\n'.format(pkg_name) diff --git a/tests/integration/test_install_uri.py b/tests/integration/test_install_uri.py index 5f4e9daf..a0ecf04d 100644 --- a/tests/integration/test_install_uri.py +++ b/tests/integration/test_install_uri.py @@ -240,15 +240,13 @@ def test_get_vcs_refs(PipenvInstance_NoPyPI): @pytest.mark.install @pytest.mark.needs_internet @pytest.mark.py3_only -@pytest.mark.skip_py38 def test_vcs_entry_supersedes_non_vcs(PipenvInstance): """See issue #2181 -- non-editable VCS dep was specified, but not showing up in the lockfile -- due to not running pip install before locking and not locking the resolution graph of non-editable vcs dependencies. """ with PipenvInstance(chdir=True) as p: - # pyinstaller_path = p._pipfile.get_fixture_path("git/pyinstaller") - pyinstaller_uri = "https://github.com/pyinstaller/pyinstaller.git" + jinja2_uri = p._pipfile.get_fixture_path("git/jinja2").as_uri() with open(p.pipfile_path, "w") as f: f.write( """ @@ -258,20 +256,20 @@ verify_ssl = true name = "pypi" [packages] -PyUpdater = "*" -PyInstaller = {{ref = "v3.6", git = "{0}"}} - """.format(pyinstaller_uri).strip() +Flask = "*" +Jinja2 = {{ref = "2.11.0", git = "{0}"}} + """.format(jinja2_uri).strip() ) c = p.pipenv("install") assert c.return_code == 0 - installed_packages = ["PyUpdater", "PyInstaller"] + installed_packages = ["Flask", "Jinja2"] assert all([k in p.pipfile["packages"] for k in installed_packages]) assert all([k.lower() in p.lockfile["default"] for k in installed_packages]) - assert all([k in p.lockfile["default"]["pyinstaller"] for k in ["ref", "git"]]), str(p.lockfile["default"]) - assert p.lockfile["default"]["pyinstaller"].get("ref") is not None + assert all([k in p.lockfile["default"]["jinja2"] for k in ["ref", "git"]]), str(p.lockfile["default"]) + assert p.lockfile["default"]["jinja2"].get("ref") is not None assert ( - p.lockfile["default"]["pyinstaller"]["git"] - == pyinstaller_uri + p.lockfile["default"]["jinja2"]["git"] + == jinja2_uri )