Skip to content

Commit

Permalink
Update coverage configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
thebigmunch committed Mar 2, 2020
1 parent 32cb1c0 commit 2e962cf
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 17 deletions.
19 changes: 13 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,24 @@ test = [

[tool.coverage.run]
branch = true
source = [ "audio_metadata" ]
omit = [
"**/__about__.py",
"**/__init__.py",
"**/exceptions.py",
"**/formats/tables.py",
source = [
"audio_metadata",
"tests",
]

[tool.coverage.report]
precision = 2
show_missing = true
exclude_lines = [
"__all__",
"import",
"except ImportError:",
"pass",
"# pragma: nocover",
"# pragma: no cover",
"# pragma: nobranch",
"# pragma: no branch",
]


[tool.ward]
Expand Down
4 changes: 2 additions & 2 deletions src/audio_metadata/formats/flac.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
StreamInfo,
)

try: # pragma: nocover
try:
import bitstruct.c as bitstruct
except ImportError: # pragma: nocover
except ImportError:
import bitstruct


Expand Down
4 changes: 2 additions & 2 deletions src/audio_metadata/formats/id3v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
from ..utils import decode_synchsafe_int
from ..warnings import AudioMetadataWarning

try: # pragma: nocover
try:
import bitstruct.c as bitstruct
except ImportError: # pragma: nocover
except ImportError:
import bitstruct


Expand Down
4 changes: 2 additions & 2 deletions src/audio_metadata/formats/mp3.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@
humanize_sample_rate,
)

try: # pragma: nocover
try:
import bitstruct.c as bitstruct
bitstruct.Error = (TypeError, ValueError)
except ImportError: # pragma: nocover
except ImportError:
import bitstruct
bitstruct.Error = (bitstruct.Error,)

Expand Down
4 changes: 2 additions & 2 deletions src/audio_metadata/formats/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
)


class _BaseEnum(Enum): # pragma: nocover
class _BaseEnum(Enum):
def __repr__(self):
return f'<{self.__class__.__name__}.{self.name}>'


class _BaseIntEnum(IntEnum): # pragma: nocover
class _BaseIntEnum(IntEnum):
def __repr__(self):
return f'<{self.__class__.__name__}.{self.name}>'

Expand Down
4 changes: 2 additions & 2 deletions src/audio_metadata/formats/wav.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ def load(cls, data):
raise
else:
self._id3 = id3
else:
else: # pragma: nocover
# TODO
self._obj.seek(subchunk_size, os.SEEK_CUR) # pragma: nocover
self._obj.seek(subchunk_size, os.SEEK_CUR)

subchunk_header = self._obj.read(8)

Expand Down
2 changes: 1 addition & 1 deletion src/audio_metadata/warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


# Override warning output format.
def showwarning(message, category, filename, lineno, file=None, line=None):
def showwarning(message, category, filename, lineno, file=None, line=None): # pragma: nocover
if file is None:
file = sys.stderr
if file is None:
Expand Down
23 changes: 23 additions & 0 deletions tests/test_formats_tables.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from ward import test

from audio_metadata.formats.tables import (
_BaseEnum,
_BaseIntEnum,
)


class TestEnum(_BaseEnum):
MEMBER = 0


class TestIntEnum(_BaseIntEnum):
MEMBER = 0


@test(
"Table enum reprs",
tags=['unit', 'formats', 'tables'],
)
def _():
assert repr(TestEnum.MEMBER) == '<TestEnum.MEMBER>'
assert repr(TestIntEnum.MEMBER) == '<TestIntEnum.MEMBER>'

0 comments on commit 2e962cf

Please sign in to comment.