diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 036e59a66..1e025ae73 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -7,7 +7,7 @@ pr: variables: - group: Codecov - name: grayskull_deps - value: pytest pytest-azurepipelines pytest-xdist pytest-cov requests ruamel.yaml codecov ruamel.yaml.jinja2 "coverage<5.0" stdlib-list pip setuptools mock fuzzywuzzy git colorama progressbar2 + value: pytest pytest-azurepipelines pytest-xdist pytest-cov pytest-forked requests ruamel.yaml codecov ruamel.yaml.jinja2 "coverage<5.0" stdlib-list pip setuptools mock fuzzywuzzy git colorama progressbar2 jobs: - job: @@ -52,16 +52,33 @@ jobs: pytest tests \ -vv \ -n 0 \ + -m "serial" \ --color=yes \ --cov=./ \ --cov-append \ - --cov-report html:converage-html \ + --cov-report html:coverage-serial-html \ + --cov-report xml:coverage-serial.xml \ + --test-run-title="Linux-py${PYTHON_VERSION}-Serial" \ + --cov-config=$(Build.Repository.LocalPath)/.coveragerc \ + --junit-xml=Linux-py${PYTHON_VERSION}-serial.xml \ + --junit-prefix=Linux-py${PYTHON_VERSION}-serial + displayName: Running Serial Tests + - bash: | + source activate grayskull + pytest tests \ + -vv \ + -n auto \ + -m "not serial" \ + --color=yes \ + --cov=./ \ + --cov-append \ + --cov-report html:coverage-html \ --cov-report xml:coverage.xml \ --test-run-title="Linux-py${PYTHON_VERSION}" \ --cov-config=$(Build.Repository.LocalPath)/.coveragerc \ --junit-xml=Linux-py${PYTHON_VERSION}.xml \ --junit-prefix=Linux-py${PYTHON_VERSION} - displayName: Running Tests + displayName: Running Parallel Tests - bash: | source activate grayskull codecov --token=$(CODECOV_TOKEN) @@ -112,6 +129,23 @@ jobs: pytest tests \ -vv \ -n 0 \ + -m "serial" \ + --color=yes \ + --cov=./ \ + --cov-append \ + --cov-report html:converage-html-serial \ + --cov-report xml:coverage.xml-serial \ + --test-run-title="OSX-py${PYTHON_VERSION}-serial" \ + --cov-config=$(Build.Repository.LocalPath)/.coveragerc \ + --junit-xml=OSX-py${PYTHON_VERSION}-serial.xml \ + --junit-prefix=OSX-py${PYTHON_VERSION}-serial + displayName: Running Serial Tests + - bash: | + source activate grayskull + pytest tests \ + -vv \ + -n auto \ + -m "not serial" \ --color=yes \ --cov=./ \ --cov-append \ @@ -121,7 +155,7 @@ jobs: --cov-config=$(Build.Repository.LocalPath)/.coveragerc \ --junit-xml=OSX-py${PYTHON_VERSION}.xml \ --junit-prefix=OSX-py${PYTHON_VERSION} - displayName: Running Tests + displayName: Running Parallel Tests - bash: | source activate grayskull codecov --token=$(CODECOV_TOKEN) @@ -168,6 +202,22 @@ jobs: pytest tests ^ -vv ^ -n 0 ^ + -m "serial" ^ + --color=yes ^ + --cov=./ ^ + --cov-append ^ + --cov-report xml:coverage-serial.xml ^ + --test-run-title="OSX-py%PYTHON_VERSION%-serial" ^ + --cov-config=$(Build.Repository.LocalPath)/.coveragerc ^ + --junit-xml=OSX-py%PYTHON_VERSION%-serial.xml ^ + --junit-prefix=OSX-py%PYTHON_VERSION%-serial + displayName: Running Serial tests + - script: | + call activate grayskull + pytest tests ^ + -vv ^ + -n auto ^ + -m "not serial" ^ --color=yes ^ --cov=./ ^ --cov-append ^ @@ -176,7 +226,7 @@ jobs: --cov-config=$(Build.Repository.LocalPath)/.coveragerc ^ --junit-xml=OSX-py%PYTHON_VERSION%.xml ^ --junit-prefix=OSX-py%PYTHON_VERSION% - displayName: Running tests + displayName: Running Parallel tests - script: | call activate grayskull diff --git a/grayskull/pypi/pypi.py b/grayskull/pypi/pypi.py index 8f40c4d8f..0af799b99 100644 --- a/grayskull/pypi/pypi.py +++ b/grayskull/pypi/pypi.py @@ -205,6 +205,8 @@ def _injection_distutils(folder: str) -> dict: data_dist = {} def __fake_distutils_setup(*args, **kwargs): + if not isinstance(kwargs, dict) or not kwargs: + return data_dist.update(kwargs) if not data_dist.get("setup_requires"): data_dist["setup_requires"] = [] @@ -212,7 +214,7 @@ def __fake_distutils_setup(*args, **kwargs): kwargs.get("setup_requires") if kwargs.get("setup_requires") else [] ) - if "use_scm_version" in kwargs and kwargs["use_scm_version"]: + if "use_scm_version" in data_dist and kwargs["use_scm_version"]: log.debug("setuptools_scm found on setup.py") if "setuptools_scm" not in data_dist["setup_requires"]: data_dist["setup_requires"] += ["setuptools_scm"] diff --git a/pytest.ini b/pytest.ini index 23c5121a3..1b3edb120 100644 --- a/pytest.ini +++ b/pytest.ini @@ -3,3 +3,5 @@ junit_family=xunit2 junit_duration_report=call addopts = -ra -q testpaths = tests +markers = + serial: Mark for tests which cannot be executed in parallel diff --git a/tests/test_pypi.py b/tests/test_pypi.py index 9e66fb96c..3ee56007c 100644 --- a/tests/test_pypi.py +++ b/tests/test_pypi.py @@ -324,6 +324,11 @@ def test_ciso_recipe(): assert recipe["test"]["imports"] == "ciso" +@pytest.mark.serial +@pytest.mark.xfail( + condition=(sys.platform.startswith("win")), + reason="Test failing on windows platform", +) def test_pymc_recipe_fortran(): recipe = PyPi(name="pymc", version="2.3.6") assert sorted(recipe["requirements"]["build"]) == sorted( @@ -459,11 +464,13 @@ def test_mypy_deps_normalization_and_entry_points(): ] +@pytest.mark.skipif( + condition=sys.platform.startswith("win"), reason="Skipping test for win" +) def test_panel_entry_points(tmpdir): recipe = PyPi(name="panel", version="0.9.1") - assert recipe["build"]["entry_points"] == "panel = panel.cli:main" recipe.generate_recipe(folder_path=str(tmpdir)) recipe_path = str(tmpdir / "panel" / "meta.yaml") with open(recipe_path, "r") as f: content = f.read() - assert " entry_points:\n - panel = panel.cli:main" in content + assert "- panel = panel.cli:main" in content