From 3fa4c00fb1cb34b1b47914e4d92ba8da2cdc2c82 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 25 Sep 2016 04:13:18 +0300 Subject: [PATCH] Globally skip a module that requires Postgres connection --- tests/test_mysql2postgres.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_mysql2postgres.py b/tests/test_mysql2postgres.py index 37edb57..b81c6bf 100644 --- a/tests/test_mysql2postgres.py +++ b/tests/test_mysql2postgres.py @@ -1,10 +1,13 @@ from sqlparse import parse from sqlobject.tests.dbtest import getConnection -import py.test +import pytest from sqlconvert.print_tokens import tlist2str from sqlconvert.process_mysql import unescape_strings +connection = getConnection() +pytestmark = pytest.mark.skipif(connection.dbName != "postgres", + reason="This test requires PostgreSQL") create_postgres_test_table = """ CREATE TABLE test ( @@ -15,9 +18,6 @@ CREATE TABLE test ( def test_mysql2postgres_string(): - connection = getConnection() - if connection.dbName != "postgres": - py.test.skip("This test requires PostgreSQL") connection.query(create_postgres_test_table) parsed = parse("insert into test (id, test_str) " "values (1, '\"te\\'st\\\"')")[0] -- 2.39.5