Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor cleanup and blacklisting pytest 3.3.0 #126

Merged
merged 3 commits into from
Nov 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/aws_encryption_sdk_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from aws_encryption_sdk_cli.internal.metadata import MetadataWriter # noqa pylint: disable=unused-import


try: # Python 3.5.0 and 3.5.1 have incompatible typing modules
try: # Python 3.5.0 and 3.5.1 have incompatible typing modules
from typing import List, Optional, Union # noqa pylint: disable=unused-import
from aws_encryption_sdk_cli.internal.mypy_types import STREAM_KWARGS # noqa pylint: disable=unused-import
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion src/aws_encryption_sdk_cli/internal/arg_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from aws_encryption_sdk_cli.internal.logging_utils import LOGGER_NAME
from aws_encryption_sdk_cli.internal.metadata import MetadataWriter

try: # Python 3.5.0 and 3.5.1 have incompatible typing modules
try: # Python 3.5.0 and 3.5.1 have incompatible typing modules
from typing import Any, Dict, List, Optional, Sequence, Tuple, Union # noqa pylint: disable=unused-import
from aws_encryption_sdk_cli.internal.mypy_types import ( # noqa pylint: disable=unused-import
ARGPARSE_TEXT, CACHING_CONFIG, COLLAPSED_CONFIG,
Expand Down
6 changes: 3 additions & 3 deletions src/aws_encryption_sdk_cli/internal/encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
import io
import logging
import string
from typing import IO, Iterable, List, Optional # noqa pylint: disable=unused-import
from types import TracebackType # noqa pylint: disable=unused-import

import six

from aws_encryption_sdk_cli.internal.logging_utils import LOGGER_NAME

try: # Python 3.5.0 and 3.5.1 have incompatible typing modules
from types import TracebackType # noqa pylint: disable=unused-import
try: # Python 3.5.0 and 3.5.1 have incompatible typing modules
from typing import IO, Iterable, List, Optional # noqa pylint: disable=unused-import
except ImportError:
# We only actually need these imports when running the mypy checks
pass
Expand Down
2 changes: 1 addition & 1 deletion src/aws_encryption_sdk_cli/internal/identifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"""Static identifier values for the AWS Encryption SDK CLI."""
from enum import Enum

try: # Python 3.5.0 and 3.5.1 have incompatible typing modules
try: # Python 3.5.0 and 3.5.1 have incompatible typing modules
from typing import Dict, Set # noqa pylint: disable=unused-import
except ImportError:
# We only actually need these imports when running the mypy checks
Expand Down
2 changes: 1 addition & 1 deletion src/aws_encryption_sdk_cli/internal/io_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from aws_encryption_sdk_cli.internal.metadata import json_ready_header, json_ready_header_auth
from aws_encryption_sdk_cli.internal.metadata import MetadataWriter

try: # Python 3.5.0 and 3.5.1 have incompatible typing modules
try: # Python 3.5.0 and 3.5.1 have incompatible typing modules
from typing import cast, Dict, IO, List, Type, Union # noqa pylint: disable=unused-import
from aws_encryption_sdk_cli.internal.mypy_types import SOURCE, STREAM_KWARGS # noqa pylint: disable=unused-import
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion src/aws_encryption_sdk_cli/internal/logging_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import json
import logging

try: # Python 3.5.0 and 3.5.1 have incompatible typing modules
try: # Python 3.5.0 and 3.5.1 have incompatible typing modules
from typing import cast, Dict, Sequence, Text, Union # noqa pylint: disable=unused-import
except ImportError:
# We only actually need these imports when running the mypy checks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from aws_encryption_sdk_cli.internal.identifiers import MASTER_KEY_PROVIDERS_ENTRY_POINT, PLUGIN_NAMESPACE_DIVIDER
from aws_encryption_sdk_cli.internal.logging_utils import LOGGER_NAME

try: # Python 3.5.0 and 3.5.1 have incompatible typing modules
try: # Python 3.5.0 and 3.5.1 have incompatible typing modules
from typing import Callable, DefaultDict, Dict, List, Union # noqa pylint: disable=unused-import
from aws_encryption_sdk_cli.internal.mypy_types import ( # noqa pylint: disable=unused-import
CACHING_CONFIG, RAW_MASTER_KEY_PROVIDER_CONFIG
Expand Down
2 changes: 1 addition & 1 deletion src/aws_encryption_sdk_cli/internal/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from aws_encryption_sdk.internal.structures import MessageHeaderAuthentication # noqa pylint: disable=unused-import
import six

try: # Python 3.5.0 and 3.5.1 have incompatible typing modules
try: # Python 3.5.0 and 3.5.1 have incompatible typing modules
from typing import Any, Dict, IO, Optional, Text # noqa pylint: disable=unused-import
except ImportError:
# We only actually need these imports when running the mypy checks
Expand Down
2 changes: 1 addition & 1 deletion src/aws_encryption_sdk_cli/key_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from aws_encryption_sdk_cli.exceptions import BadUserArgumentError
from aws_encryption_sdk_cli.internal.identifiers import USER_AGENT_SUFFIX

try: # Python 3.5.0 and 3.5.1 have incompatible typing modules
try: # Python 3.5.0 and 3.5.1 have incompatible typing modules
from typing import Dict, List, Text, Union # noqa pylint: disable=unused-import
except ImportError:
# We only actually need these imports when running the mypy checks
Expand Down
12 changes: 12 additions & 0 deletions test/unit/test_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,18 @@ def test_base64io_decode_with_whitespace(plaintext_source, b64_plaintext_with_wh
assert test == plaintext_source[:read_bytes]


@pytest.mark.parametrize('plaintext_source, b64_plaintext_with_whitespace, read_bytes', (
(b'\x00\x00\x00', b'AAAA', 3),
))
def test_base64io_decode_parametrized_null_bytes(plaintext_source, b64_plaintext_with_whitespace, read_bytes):
# Verifies that pytest is handling null bytes correctly (broken in 3.3.0)
# https://github.com/pytest-dev/pytest/issues/2957
with Base64IO(io.BytesIO(b64_plaintext_with_whitespace)) as decoder:
test = decoder.read(read_bytes)

assert test == plaintext_source[:read_bytes]


def test_base64io_decode_read_only_from_buffer():
plaintext_source = b'12345'
plaintext_b64 = io.BytesIO(base64.b64encode(plaintext_source))
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ passenv =
sitepackages = False
deps =
mock
pytest
pytest!=3.3.0
pytest-catchlog
pytest-cov
pytest-mock
Expand Down