From db6e2e5de710165e6669a956c9814b5256f89a55 Mon Sep 17 00:00:00 2001 From: Vinit Kumar Date: Sun, 16 Oct 2022 23:56:39 +0530 Subject: [PATCH] feat: make deps more flexible (#158) * feat: make deps more flexible * feat: we don't have requirements.txt anymore * fix: make testing more reliable * fix: update the test as the underlying library changed types: v0.12.0..v0.13.0 has changed the type of what is returned. ```diff -from collections import OrderedDict +_dict = dict +import platform ``` Authored-by: Vinit Kumar Signed-off-by: Vinit Kumar * fix: remove imports Signed-off-by: Vinit Kumar --- .github/workflows/pythonpackage.yml | 7 +------ MANIFEST.in | 2 +- requirements-dev.txt | 12 ++++++------ requirements.txt | 18 ------------------ setup.py | 2 +- tests/test_json2xml.py | 3 +-- 6 files changed, 10 insertions(+), 34 deletions(-) delete mode 100644 requirements.txt diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 86d46b7..b7d102f 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -28,12 +28,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pytest - pip install -r requirements.txt - pip install xmltodict==0.12.0 - pip install pytest==7.0.1 - pip install coverage==6.3.2 - pip install py==1.11.0 + pip install -r requirements-dev.txt python setup.py install - name: Unit tests run: | diff --git a/MANIFEST.in b/MANIFEST.in index b77663e..226ee51 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,7 +3,7 @@ include CONTRIBUTING.rst include HISTORY.rst include LICENSE include README.rst -include requirements.txt +include requirements.in recursive-include tests * recursive-exclude * __pycache__ recursive-exclude * *.py[co] diff --git a/requirements-dev.txt b/requirements-dev.txt index b9334c4..301997e 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,7 +1,7 @@ # When installing dev dependencies also install the user dependencies --r requirements.txt -xmltodict==0.12.0 -pytest==7.0.1 -coverage==6.3.2 -py==1.11.0 -flake8==4.0.1 +-r requirements.in +xmltodict>=0.12.0 +pytest +coverage +py +flake8 diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 8fc1933..0000000 --- a/requirements.txt +++ /dev/null @@ -1,18 +0,0 @@ -# -# This file is autogenerated by pip-compile with python 3.9 -# To update, run: -# -# pip-compile -# -certifi==2021.5.30 - # via requests -charset-normalizer==2.0.6 - # via requests -defusedxml==0.7.1 - # via -r requirements.in -idna==3.2 - # via requests -requests==2.26.0 - # via -r requirements.in -urllib3==1.26.7 - # via requests diff --git a/setup.py b/setup.py index 0cc0fe9..17ab21a 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ with open("HISTORY.rst") as history_file: history = history_file.read() -requirements = [open("requirements.txt").read()] +requirements = [open("requirements.in").read()] setup_requirements = [] diff --git a/tests/test_json2xml.py b/tests/test_json2xml.py index 0d3f1bb..40003fe 100644 --- a/tests/test_json2xml.py +++ b/tests/test_json2xml.py @@ -4,7 +4,6 @@ import pytest import json -from collections import OrderedDict import xmltodict from pyexpat import ExpatError @@ -68,7 +67,7 @@ def test_json_to_xml_conversion(self): ) xmldata = json2xml.Json2xml(data).to_xml() dict_from_xml = xmltodict.parse(xmldata) - assert type(dict_from_xml["all"]) == OrderedDict + assert type(dict_from_xml["all"]) == dict def test_custom_wrapper_and_indent(self): data = readfromstring(