Skip to content

Commit

Permalink
[py] Skip tests if we can't run them on that platform
Browse files Browse the repository at this point in the history
  • Loading branch information
AutomatedTester committed Nov 13, 2020
1 parent 5f67a3c commit 9d6c5f7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions py/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# under the License.

import os
import platform
import socket
import subprocess
import sys
Expand Down Expand Up @@ -81,6 +82,15 @@ def driver(request):
except AttributeError:
raise Exception('This test requires a --driver to be specified.')

# skip tests if not available on the platform
_platform = platform.system()
if driver_class == "Safari" and _platform != "Darwin":
pytest.skip("Safari tests can only run on an Apple OS")
if (driver_class == "Ie" or driver_class == "Edge") and _platform != "Windows":
pytest.skip("IE and EdgeHTML Tests can only run on Windows")
if "WebKit" in driver_class and _platform != "Linux":
pytest.skip("Webkit tests can only run on Linux")

# conditionally mark tests as expected to fail based on driver
marker = request.node.get_closest_marker('xfail_{0}'.format(driver_class.lower()))

Expand Down

0 comments on commit 9d6c5f7

Please sign in to comment.