-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from MusicalNinjaRandInt/working
v0.2.1
- Loading branch information
Showing
12 changed files
with
144 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.2.0 | ||
0.2.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,9 @@ | |
"path": "." | ||
} | ||
], | ||
"settings": {} | ||
"settings": { | ||
"black-formatter.args": [ | ||
"-S" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
LOGROOT = 'dupes' | ||
|
||
from .dupes import * | ||
from .bufferediofile import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,26 @@ | ||
from .. import * | ||
from pytest import mark, raises, skip | ||
from pytest import mark, raises, skip | ||
|
||
@contextmanager | ||
def skipon(exceptiontype: Exception, check: callable = lambda x: True, reason: str = ''): | ||
"""Skip test on Exception of type exceptiontype. | ||
Optionally run additional validation of exception before skipping. | ||
Arguments: | ||
- exceptiontype: the type of exception to skip | ||
- check (optional): a `callable` which returns a single `bool` value. | ||
Test will only be skipped if this check results `True` | ||
- reason (optional): reason to be passed to `skip` and included in the test logs | ||
Example: | ||
``` | ||
with skipon(OSError, lambda e: e.winerror == 1314, 'SymLinks not available on Windows without DevMode enabled') | ||
... | ||
``` | ||
will skip test if Windows throws an OSError on missing permissions to create a symlink | ||
""" | ||
|
||
try: | ||
yield | ||
except exceptiontype as e: | ||
if check(e): skip(reason=reason) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from . import * | ||
import logging | ||
|
||
|
||
@mark.copyfiles(('fileA', 2), ('fileB', 1), ('fileA2', 1)) | ||
@mark.linkfiles(('fileA', 1)) | ||
def test_instantiatefrompath(copiedtestfiles, caplog): | ||
caplog.set_level(logging.INFO, logger='dupes') | ||
_ = DuplicateFiles.frompath(copiedtestfiles.root) | ||
logs = [record for record in caplog.records if record.name.startswith(LOGROOT)] | ||
logmessages = [record.message for record in logs] | ||
|
||
expectedmessages = [ | ||
f'Initiating search of {copiedtestfiles.root}', | ||
f'Found 1 groups of same-sized files', | ||
f'Identified 1 pre-existing hard links', | ||
f'Will now begin comparing file contents, this may take some time', | ||
f'Identified 1 sets of duplicate files, totalling 2 files', | ||
f'Current usage: 32, future usage: 16, saving: 16' | ||
] | ||
|
||
assert ( | ||
logmessages == expectedmessages | ||
), f'\nReceived log: {logmessages}\nExpected: {expectedmessages}\nMissing: {set(expectedmessages).difference(logmessages)}\nExtra: {set(logmessages).difference(expectedmessages)}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters