Skip to content

Commit

Permalink
chore: Get rid of py2 import stuff (#3018)
Browse files Browse the repository at this point in the history
  • Loading branch information
aahung committed Mar 11, 2023
1 parent a584f0e commit 04fcfe0
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 40 deletions.
11 changes: 3 additions & 8 deletions integration/combination/test_api_settings.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import hashlib
from pathlib import Path
from unittest.case import skipIf

from integration.config.service_names import REST_API
from integration.helpers.resource import current_region_does_not_support

try:
from pathlib import Path
except ImportError:
from pathlib2 import Path

from parameterized import parameterized

from integration.config.service_names import REST_API
from integration.helpers.base_test import BaseTest
from integration.helpers.resource import current_region_does_not_support


@skipIf(current_region_does_not_support([REST_API]), "Rest API is not supported in this testing region")
Expand Down
6 changes: 1 addition & 5 deletions integration/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import time
from pathlib import Path

import boto3
import botocore
Expand All @@ -18,11 +19,6 @@
from integration.helpers.stack import Stack
from integration.helpers.yaml_utils import load_yaml

try:
from pathlib import Path
except ImportError:
from pathlib2 import Path

LOG = logging.getLogger(__name__)

COMPANION_STACK_NAME = "sam-integ-stack-companion"
Expand Down
16 changes: 5 additions & 11 deletions integration/helpers/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
import logging
import os
import shutil
from pathlib import Path
from unittest.case import TestCase

import boto3
import botocore
import pytest
import requests
Expand All @@ -20,6 +23,7 @@

from integration.config.logger_configurations import LoggingConfiguration
from integration.helpers.client_provider import ClientProvider
from integration.helpers.deployer.deployer import Deployer
from integration.helpers.deployer.exceptions.exceptions import ThrottlingError
from integration.helpers.deployer.utils.retry import retry_with_exponential_backoff_and_jitter
from integration.helpers.exception import StatusCodeError
Expand All @@ -32,18 +36,8 @@
verify_stack_resources,
)
from integration.helpers.s3_uploader import S3Uploader
from integration.helpers.yaml_utils import dump_yaml, load_yaml

try:
from pathlib import Path
except ImportError:
from pathlib2 import Path
from unittest.case import TestCase

import boto3

from integration.helpers.deployer.deployer import Deployer
from integration.helpers.template import transform_template
from integration.helpers.yaml_utils import dump_yaml, load_yaml

LOG = logging.getLogger(__name__)

Expand Down
1 change: 0 additions & 1 deletion integration/helpers/deployer/utils/artifact_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Logic for uploading to S3 per Cloudformation Specific Resource
This was ported over from the sam-cli repo
"""
# pylint: disable=no-member

# Copyright 2012-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
Expand Down
16 changes: 6 additions & 10 deletions integration/helpers/resource.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import json
import random
import re
import string # pylint: disable=deprecated-module
import string
from pathlib import Path
from typing import Any, Callable, Dict, Iterator, Set

import boto3
from botocore.exceptions import NoRegionError
from samtranslator.translator.logical_id_generator import LogicalIdGenerator

from integration.config.service_names import (
APP_SYNC,
DYNAMO_DB,
Expand All @@ -18,15 +23,6 @@
)
from integration.helpers.yaml_utils import load_yaml

try:
from pathlib import Path
except ImportError:
from pathlib2 import Path

import boto3
from botocore.exceptions import NoRegionError
from samtranslator.translator.logical_id_generator import LogicalIdGenerator

# Length of the random suffix added at the end of the resources we create
# to avoid collisions between tests
RANDOM_SUFFIX_LENGTH = 12
Expand Down
7 changes: 2 additions & 5 deletions integration/helpers/stack.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from pathlib import Path

import botocore

from integration.helpers.deployer.deployer import Deployer
Expand All @@ -6,11 +8,6 @@
from integration.helpers.resource import generate_suffix
from integration.helpers.template import transform_template

try:
from pathlib import Path
except ImportError:
from pathlib2 import Path


class Stack:
def __init__(self, stack_name, template_path, cfn_client, output_dir):
Expand Down

0 comments on commit 04fcfe0

Please sign in to comment.