Skip to content

Commit

Permalink
Merge pull request #104 from marcelotrevisani/enable-pytest-xdist
Browse files Browse the repository at this point in the history
Enable pytest-xdist
  • Loading branch information
marcelotrevisani authored Mar 18, 2020
2 parents ef7dc55 + f33df64 commit d94db7d
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 8 deletions.
60 changes: 55 additions & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 \
Expand All @@ -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)
Expand Down Expand Up @@ -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 ^
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion grayskull/pypi/pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,16 @@ 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"] = []
data_dist["setup_requires"] += (
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"]
Expand Down
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 9 additions & 2 deletions tests/test_pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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

0 comments on commit d94db7d

Please sign in to comment.