From ebd56088ac7f504fe6ce220ab8e4baa9b995d240 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@ericsson.com>
Date: Mon, 2 Sep 2024 09:18:12 +0200
Subject: [PATCH] fix unit tests

---
 CHANGELOG.md                    | 3 ++-
 README.md                       | 2 +-
 compile_definitions/__main__.py | 9 ++++-----
 coolamqp/__init__.py            | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5423a09..0f74fdd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,4 +4,5 @@ have been made so far, between releases.
 
 # v1.3.2
 
-* removed the requirement for a Queue that for it to be equal to other Queue if their types do match
\ No newline at end of file
+* removed the requirement for a Queue that for it to be equal to other Queue if their types do match
+* compile_definitions will now depend on requests
diff --git a/README.md b/README.md
index 0160f4f..7873170 100644
--- a/README.md
+++ b/README.md
@@ -99,7 +99,7 @@ A tool to generate [definitions.py](coolamqp/framing/definitions.py) from the AM
 
 In order to compile the definitions:
 
-* Make sure that you have `yapf` installed
+* Make sure that you have `yapf` and `requests` installed
 * then perform:
   ```python
   python -m compile_definitions
diff --git a/compile_definitions/__main__.py b/compile_definitions/__main__.py
index 124f786..c3d26de 100644
--- a/compile_definitions/__main__.py
+++ b/compile_definitions/__main__.py
@@ -5,14 +5,12 @@ import sys
 if sys.version.startswith('2.'):
     raise RuntimeError('Cannot run under Python 2.7')
 
-from urllib.request import urlopen
+import requests
 import collections
 import math
 import struct
 import subprocess
-from io import BytesIO
 from xml.etree import ElementTree
-from zipfile import ZipFile
 
 import six
 
@@ -37,9 +35,10 @@ TYPE_TRANSLATOR = {
 def get_xml(xml_file):
     """Download XML definition from OASIS's website"""
 
-    r = urlopen(f'https://www.rabbitmq.com/resources/specs/amqp0-9-1.extended.xml')
+    r = requests.get('https://www.rabbitmq.com/resources/specs/amqp0-9-1.extended.xml')
+    r.raise_for_status()
     with open(xml_file, 'wb') as out:
-        out.write(r.read())
+        out.write(r.content)
 
 
 def compile_definitions(xml_file='amqp0-9-1.extended.xml',
diff --git a/coolamqp/__init__.py b/coolamqp/__init__.py
index c7d8778..f81ce5a 100644
--- a/coolamqp/__init__.py
+++ b/coolamqp/__init__.py
@@ -1 +1 @@
-__version__ = '1.3.2a2'
+__version__ = '1.3.2a3'
-- 
GitLab