Rev4016, Add ad test Python 3.4 compatibility

This commit is contained in:
shortcutme 2019-03-21 02:22:22 +01:00
parent 1da6c8c84e
commit 60405bf222
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
5 changed files with 10 additions and 4 deletions

View File

@ -2,6 +2,9 @@ language: python
matrix:
include:
- python: 3.4
dist: trusty
sudo: false
- python: 3.5
dist: trusty
sudo: false

View File

@ -6,6 +6,7 @@ import collections
import math
import warnings
import base64
import binascii
import gevent
import gevent.lock
@ -66,7 +67,7 @@ class UiRequestPlugin(object):
)
if len(piecemap_info["sha512_pieces"]) == 1: # Small file, don't split
hash = piecemap_info["sha512_pieces"][0].hex()
hash = binascii.hexlify(piecemap_info["sha512_pieces"][0].encode())
hash_id = site.content_manager.hashfield.getHashId(hash)
site.content_manager.optionalDownloaded(inner_path, hash_id, upload_info["size"], own=True)

View File

@ -1,5 +1,6 @@
import time
import io
import binascii
import pytest
import mock
@ -39,7 +40,7 @@ class TestBigfile:
piecemap = Msgpack.unpack(site.storage.open(file_node["piecemap"], "rb").read())["optional.any.iso"]
assert len(piecemap["sha512_pieces"]) == 10
assert piecemap["sha512_pieces"][0] != piecemap["sha512_pieces"][1]
assert piecemap["sha512_pieces"][0].hex() == "a73abad9992b3d0b672d0c2a292046695d31bebdcb1e150c8410bbe7c972eff3"
assert binascii.hexlify(piecemap["sha512_pieces"][0].encode()) == b"a73abad9992b3d0b672d0c2a292046695d31bebdcb1e150c8410bbe7c972eff3"
def testVerifyPiece(self, site):
inner_path = self.createBigfile(site)

View File

@ -13,7 +13,7 @@ class Config(object):
def __init__(self, argv):
self.version = "0.7.0"
self.rev = 4015
self.rev = 4016
self.argv = argv
self.action = None
self.pending_changes = {}

View File

@ -1,6 +1,7 @@
import logging
import json
import time
import binascii
import gevent
@ -53,7 +54,7 @@ class User(object):
self.delayed_save_thread = gevent.spawn_later(5, self.save)
def getAddressAuthIndex(self, address):
return int(address.encode("ascii").hex(), 16)
return int(binascii.hexlify(address.encode()), 16)
@util.Noparallel()
def generateAuthAddress(self, address):