Page MenuHomePhabricator
Paste P7084

Wheeee, py3 failures!
ArchivedPublic

Authored by demon on May 4 2018, 7:47 PM.
Tags
None
Referenced Files
F17724124: Wheeee, py3 failures!
May 4 2018, 7:47 PM
Subscribers
None
chad@derpy ~/git/scappish/scap (master) $ python3 -m pytest
Test session starts (platform: darwin, Python 3.6.5, pytest 3.5.1, pytest-sugar 0.9.1)
rootdir: /Users/chad/git/scappish/scap, inifile: tox.ini
plugins: sugar-0.9.1, leaks-0.2.2, cov-2.5.1
scap/ansi.py ✓✓✓ 3% ▍
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― [doctest] scap.cdblib.Reader.__init__ ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
059
060 Create an instance reading from a sequence and hash keys using hashfn.
061
062 >>> Reader(data='')
Differences (unified diff with -expected +actual):
@@ -1,3 +1,8 @@
Traceback (most recent call last):
-...
-IOError: CDB too small
+ File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/doctest.py", line 1330, in __run
+ compileflags, 1), test.globs)
+ File "<doctest scap.cdblib.Reader.__init__[0]>", line 1, in <module>
+ Reader(data='')
+ File "/Users/chad/git/scappish/scap/scap/cdblib.py", line 70, in __init__
+ raise IOError('CDB too small')
+OSError: CDB too small
/Users/chad/git/scappish/scap/scap/cdblib.py:62: DocTestFailure
scap/cdblib.py ⨯ 4% ▍
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― [doctest] scap.cdblib.Writer.__init__ ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
105
106 Create an instance writing to a file-like object and hash keys.
107
108 It uses hashfn to hash keys.
109
110 >>> import tempfile
111 >>> temp_fp = tempfile.TemporaryFile()
112 >>> Writer(fp=temp_fp, hashfn=py_djb_hash) #doctest: +ELLIPSIS
UNEXPECTED EXCEPTION: TypeError("a bytes-like object is required, not 'str'",)
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/doctest.py", line 1330, in __run
compileflags, 1), test.globs)
File "<doctest scap.cdblib.Writer.__init__[2]>", line 1, in <module>
File "/Users/chad/git/scappish/scap/scap/cdblib.py", line 118, in __init__
fp.write('\x00' * 2048)
TypeError: a bytes-like object is required, not 'str'
/Users/chad/git/scappish/scap/scap/cdblib.py:112: UnexpectedException
scap/cdblib.py ⨯ 5% ▌
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― [doctest] scap.cdblib.py_djb_hash ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
026
027 Return the value of DJB's hash function for the given 8-bit string.
028
029 >>> py_djb_hash('')
030 5381
031 >>> py_djb_hash('')
032 177572
033 >>> py_djb_hash('€')
Expected:
193278953
Got:
169225
/Users/chad/git/scappish/scap/scap/cdblib.py:33: DocTestFailure
scap/cdblib.py ⨯ 6% ▋
scap/git.py ✓ 7% ▋
scap/log.py ✓✓ 8% ▉
scap/utils.py ✓✓ 10% █▏
tests/scap/test_checks.py ✓✓✓✓✓ssss 19% █▉
tests/scap/test_cmd.py ✓ 20% ██
tests/scap/test_config.py ✓✓✓✓ 24% ██▍
tests/scap/test_context.py ✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓s✓✓✓✓✓✓✓ 46% ████▋
tests/scap/test_git.py ✓✓✓✓✓✓✓✓ 54% █████▍
tests/scap/test_lint.py ss✓✓ 58% █████▊
tests/scap/test_log.py ✓✓✓✓✓✓✓✓✓✓✓✓✓✓ 71% ███████▏
tests/scap/test_nrpe.py ✓✓✓ 74% ███████▍
tests/scap/test_script.py ✓✓ 75% ███████▋
tests/scap/test_ssh.py ✓✓✓ 78% ███████▉
tests/scap/test_targets.py ✓✓ 80% ████████
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― test_dsh_target_default_groups ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
def test_dsh_target_default_groups():
dsh_file = 'test-targets'
dsh_path = os.path.join(os.path.dirname(__file__), 'targets-test')
target_obj = targets.get(dsh_file, {dsh_file: dsh_file},
extra_paths=[dsh_path])
deploy_groups = target_obj.groups
# Without a group in the config, the only group should be "default"
assert len(deploy_groups.keys()) == 1
> assert deploy_groups.keys()[0] == 'default'
E TypeError: 'odict_keys' object does not support indexing
tests/scap/test_targets.py:46: TypeError
tests/scap/test_targets.py ⨯ 81% ████████▎
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― test_dsh_target_other_groups ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
def test_dsh_target_other_groups():
dsh_file = 'test-targets'
canary_test_targets = 'canary_test-targets'
dsh_path = os.path.join(os.path.dirname(__file__), 'targets-test')
cfg = {'server_groups': 'canary,default',
dsh_file: dsh_file,
canary_test_targets: canary_test_targets}
target_obj = targets.get(dsh_file, cfg, extra_paths=[dsh_path])
deploy_groups = target_obj.groups
# Since server_groups is set, there should be 2 groups:
# canary and default
assert len(deploy_groups.keys()) == 2
> assert deploy_groups.keys()[0] == 'canary'
E TypeError: 'odict_keys' object does not support indexing
tests/scap/test_targets.py:65: TypeError
tests/scap/test_targets.py ⨯✓✓✓✓✓✓✓✓✓✓✓ 92% █████████▎
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― test_subgroups__splits_and_labels_targets_according_to_size ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
def test_subgroups__splits_and_labels_targets_according_to_size():
group = targets.DeployGroup('foo', _TARGETS, 2)
subgroups = list(group.subgroups())
> assert subgroups == [('foo1', ['target1', 'target2']),
('foo2', ['target3'])]
E AssertionError: assert [('foo1.0', [... ['target3'])] == [('foo1', ['ta... ['target3'])]
E At index 0 diff: ('foo1.0', ['target1', 'target2']) != ('foo1', ['target1', 'target2'])
E Use -v to get the full diff
tests/scap/test_targets.py:211: AssertionError
tests/scap/test_targets.py ⨯✓✓ 95% █████████▌
tests/scap/test_tasks.py ✓ 96% █████████▋
tests/scap/test_template.py ✓ 97% █████████▊
tests/scap/test_utils.py ✓✓✓ 100% ██████████
---------- coverage: platform darwin, python 3.6.5-final-0 -----------
Coverage HTML written to dir htmlcov
Results (3.44s):
93 passed
6 failed
- scap/cdblib.py:59 [doctest] scap.cdblib.Reader.__init__
- scap/cdblib.py:105 [doctest] scap.cdblib.Writer.__init__
- scap/cdblib.py:26 [doctest] scap.cdblib.py_djb_hash
- tests/scap/test_targets.py:37 test_dsh_target_default_groups
- tests/scap/test_targets.py:49 test_dsh_target_other_groups
- tests/scap/test_targets.py:208 test_subgroups__splits_and_labels_targets_according_to_size
7 skipped