Skip to content

Commit

Permalink
Only skip unit test on MacOS and only on Github Actions (#38)
Browse files Browse the repository at this point in the history
This commit Closes #35.

We still don't know why the unit test `test_laplacian_embedding_elbowcut_none` fails on the MacOS Github Action instances, but not on any other MacOS system that we've tried.

This fix addresses the issue by effectively ignoring it as we can't reproduce it elsewhere, but it took steps to make the test be skipped only on Github Actions, only when using the .github/workflows/validate_on_push.yml workflow file, and only as long as the SKIP_TEST_35=true environment variable is used when running the test.

This means that developer/user testers of topologic with MacOS will still run this unit test, and we can also create a new branch to disable this flag and continue testing topologic + Github Actions on MacOS in an attempt to see when, or if, this is fixed (since it doesn't seem to be related to us so much as Github's CI instances).

Co-authored-by: Dwayne Pryce <dwpryce@microsoft.com>
  • Loading branch information
Dwayne Pryce and Dwayne Pryce committed Apr 1, 2020
1 parent fd7b227 commit ed30cda
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ jobs:
flake8 ./topologic ./tests --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest tests topologic --doctest-modules
pytest -v tests topologic --doctest-modules
env:
SKIP_TEST_35: true
- name: Generate docs with Sphinx
run: |
sphinx-build -W -a docs/ docs/_build/html
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/validate_on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ jobs:
flake8 ./topologic ./tests --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest tests topologic --doctest-modules
pytest -v tests topologic --doctest-modules
env:
SKIP_TEST_35: true
- name: Build with setuptools
run: |
python setup.py build sdist
Expand Down
9 changes: 5 additions & 4 deletions tests/embedding/test_laplacian_spectral_embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# Licensed under the MIT license.

import pickle
import os
import sys
import unittest

import networkx as nx
import numpy as np
import pytest

from topologic.embedding import laplacian_embedding

Expand All @@ -32,10 +32,11 @@ def test_laplacian_embedding(self):
np.testing.assert_allclose(expected_matrix, matrix, rtol=1e-5)
self.assertListEqual(expected_label, labels)

@unittest.skipIf(
sys.platform.startswith('darwin') and os.getenv("SKIP_TEST_35", "false") == "true",
"Test not supported on MacOS Github Actions, see: https://github.com/microsoft/topologic/issues/35"
)
def test_laplacian_embedding_elbowcut_none(self):
if sys.platform.startswith('darwin'):
pytest.skip('Test not supported on Mac OS')

graph = nx.Graph([('a', 'b', {'weight': 2.0}), ('b', 'c', {'weight': 2.0})])
result = laplacian_embedding(
graph,
Expand Down

0 comments on commit ed30cda

Please sign in to comment.