From e1e2a8929e049f21744f98071389bd1c2821f6dc Mon Sep 17 00:00:00 2001 From: Ion Cebotari Date: Mon, 1 Oct 2018 15:03:37 +0300 Subject: [PATCH 1/3] Changed the tests to make them work with Python 3 on Ubuntu 18.04 --- tests.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests.py b/tests.py index b793e67..216a85b 100644 --- a/tests.py +++ b/tests.py @@ -43,7 +43,7 @@ def test_create_file_and_retrieve_by_id(self): :return: None """ bucket = self.b2.buckets.get(bucket_name=self.bucket_name) - file = bucket.files.upload(contents='Hello World!', file_name='test/hello.txt') + file = bucket.files.upload(contents='Hello World!'.encode('utf-8'), file_name='test/hello.txt') file2 = bucket.files.get(file_id=file.file_id) def test_create_z_binary_file(self): @@ -102,7 +102,13 @@ def test_get_buckets(self): :return: None """ buckets = self.b2.buckets.all() - expect(len(buckets)).should.be.greater_than(1) + expect(len(buckets)).should.be.greater_than(0) + current_bucket = None + for bucket in buckets: + if bucket.bucket_name == self.bucket_name: + current_bucket = bucket + assert current_bucket != None + def test_get_files(self): """ From 11efbe662e0a0d2751cee4ba7a5d2f1b350064e8 Mon Sep 17 00:00:00 2001 From: Ion Cebotari Date: Mon, 1 Oct 2018 15:23:28 +0300 Subject: [PATCH 2/3] Changed CircleCI Python image to 3.6.6 and changed the get_bucket test --- .circleci/config.yml | 4 ++-- tests.py | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 721990d..cf2f9de 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,7 +8,7 @@ jobs: docker: # specify the version you desire here # use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers` - - image: circleci/python:2.7.15 + - image: circleci/python:3.6.6 # Specify service dependencies here if necessary # CircleCI maintains a library of pre-built images @@ -52,4 +52,4 @@ jobs: - store_artifacts: path: test-reports - destination: test-reports \ No newline at end of file + destination: test-reports diff --git a/tests.py b/tests.py index 216a85b..a49b68c 100644 --- a/tests.py +++ b/tests.py @@ -104,10 +104,7 @@ def test_get_buckets(self): buckets = self.b2.buckets.all() expect(len(buckets)).should.be.greater_than(0) current_bucket = None - for bucket in buckets: - if bucket.bucket_name == self.bucket_name: - current_bucket = bucket - assert current_bucket != None + assert any(bucket for bucket in buckets if bucket.bucket_name == self.bucket_name) == True def test_get_files(self): From 3e34ce8fdeb8e9299fbc8c78161ec16f0662301a Mon Sep 17 00:00:00 2001 From: Ion Cebotari Date: Mon, 1 Oct 2018 15:33:35 +0300 Subject: [PATCH 3/3] Removed futures from requirements, because it's not needed in Python3 --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 9e8b7cd..527abab 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,7 +14,6 @@ cryptography==2.3 curtsies==0.3.0 enum34==1.1.6 funcsigs==1.0.2 -futures==3.2.0 greenlet==0.4.13 idna==2.7 ipaddress==1.0.22