From 10d583fe4e16390b0973139fed7035cb05a99821 Mon Sep 17 00:00:00 2001 From: Stu Young Date: Wed, 17 Jul 2019 12:09:01 -0400 Subject: [PATCH] add pytest decorator for skipping py3 test (#21151) * add pytest decorator for skipping py3 test * quality --- common/test/utils.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/common/test/utils.py b/common/test/utils.py index 860314a42b..c76db470f9 100644 --- a/common/test/utils.py +++ b/common/test/utils.py @@ -6,6 +6,7 @@ import sys from contextlib import contextmanager import moto +import pytest from django.dispatch import Signal from markupsafe import escape from mock import Mock, patch @@ -153,3 +154,13 @@ def normalize_repr(func): between worker processes. """ return reprwrapper(func) + + +# Decorator for skipping tests that are not ready to be run with Python 3.x. +# While we expect many tests to fail with Python 3.x as we transition, this +# is specifically for tests that rely on external or large scale fixes. It can +# be added to individual tests or test classes. +py2_only = pytest.mark.skipif( + sys.version_info > (3, 0), + reason="This test can only be run with Python 2.7, currently" +)