1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-13 01:20:24 +02:00

pip list and pip show tests

This commit is contained in:
Kelly Brazil
2019-12-17 11:44:43 -08:00
parent 36f2812d5a
commit 224948d1f2
21 changed files with 428 additions and 0 deletions

View File

@ -0,0 +1 @@
[{"package": "bleach", "version": "3.1.0"}, {"package": "certifi", "version": "2019.9.11"}, {"package": "chardet", "version": "3.0.4"}, {"package": "docutils", "version": "0.15.2"}, {"package": "idna", "version": "2.8"}, {"package": "ifconfig-parser", "version": "0.0.5"}, {"package": "jc", "version": "1.5.1"}, {"package": "pip", "version": "19.3.1"}, {"package": "pkginfo", "version": "1.5.0.1"}, {"package": "Pygments", "version": "2.4.2"}, {"package": "readme-renderer", "version": "24.0"}, {"package": "requests", "version": "2.22.0"}, {"package": "requests-toolbelt", "version": "0.9.1"}, {"package": "setuptools", "version": "39.2.0"}, {"package": "six", "version": "1.12.0"}, {"package": "tqdm", "version": "4.36.1"}, {"package": "twine", "version": "2.0.0"}, {"package": "urllib3", "version": "1.25.6"}, {"package": "webencodings", "version": "0.5.1"}, {"package": "wheel", "version": "0.33.6"}]

22
tests/fixtures/centos-7.7/pip-list.out vendored Normal file
View File

@ -0,0 +1,22 @@
Package Version
----------------- ---------
bleach 3.1.0
certifi 2019.9.11
chardet 3.0.4
docutils 0.15.2
idna 2.8
ifconfig-parser 0.0.5
jc 1.5.1
pip 19.3.1
pkginfo 1.5.0.1
Pygments 2.4.2
readme-renderer 24.0
requests 2.22.0
requests-toolbelt 0.9.1
setuptools 39.2.0
six 1.12.0
tqdm 4.36.1
twine 2.0.0
urllib3 1.25.6
webencodings 0.5.1
wheel 0.33.6

View File

@ -0,0 +1 @@
[{"name": "setuptools", "version": "39.2.0", "summary": "Easily download, build, install, upgrade, and uninstall Python packages", "home_page": "https://github.com/pypa/setuptools", "author": "Python Packaging Authority", "author_email": "distutils-sig@python.org", "license": "UNKNOWN", "location": "/usr/lib/python3.6/site-packages", "requires": null, "required_by": "twine"}, {"name": "pkginfo", "version": "1.5.0.1", "summary": "Query metadatdata from sdists / bdists / installed packages.", "home_page": "https://code.launchpad.net/~tseaver/pkginfo/trunk", "author": "Tres Seaver, Agendaless Consulting", "author_email": "tseaver@agendaless.com", "license": "MIT", "location": "/home/kbrazil/.local/lib/python3.6/site-packages", "requires": null, "required_by": "twine"}, {"name": "six", "version": "1.12.0", "summary": "Python 2 and 3 compatibility utilities", "home_page": "https://github.com/benjaminp/six", "author": "Benjamin Peterson", "author_email": "benjamin@python.org", "license": "MIT", "location": "/home/kbrazil/.local/lib/python3.6/site-packages", "requires": null, "required_by": "readme-renderer, bleach"}]

32
tests/fixtures/centos-7.7/pip-show.out vendored Normal file
View File

@ -0,0 +1,32 @@
Name: setuptools
Version: 39.2.0
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: https://github.com/pypa/setuptools
Author: Python Packaging Authority
Author-email: distutils-sig@python.org
License: UNKNOWN
Location: /usr/lib/python3.6/site-packages
Requires:
Required-by: twine
---
Name: pkginfo
Version: 1.5.0.1
Summary: Query metadatdata from sdists / bdists / installed packages.
Home-page: https://code.launchpad.net/~tseaver/pkginfo/trunk
Author: Tres Seaver, Agendaless Consulting
Author-email: tseaver@agendaless.com
License: MIT
Location: /home/kbrazil/.local/lib/python3.6/site-packages
Requires:
Required-by: twine
---
Name: six
Version: 1.12.0
Summary: Python 2 and 3 compatibility utilities
Home-page: https://github.com/benjaminp/six
Author: Benjamin Peterson
Author-email: benjamin@python.org
License: MIT
Location: /home/kbrazil/.local/lib/python3.6/site-packages
Requires:
Required-by: readme-renderer, bleach

View File

@ -66,3 +66,5 @@ systemctl -a list-sockets > systemctl-ls.out
systemctl -a list-jobs > systemctl-jobs.out systemctl -a list-jobs > systemctl-jobs.out
du /usr > du.out du /usr > du.out
pip3 list > pip-list.out
pip3 show wheel pip jc > pip-show.out

View File

@ -0,0 +1 @@
[{"package": "ifconfig-parser", "version": "0.0.5"}, {"package": "jc", "version": "1.5.1"}, {"package": "pip", "version": "19.3.1"}, {"package": "setuptools", "version": "41.6.0"}, {"package": "wheel", "version": "0.33.6"}]

7
tests/fixtures/osx-10.11.6/pip-list.out vendored Executable file
View File

@ -0,0 +1,7 @@
Package Version
--------------- -------
ifconfig-parser 0.0.5
jc 1.5.1
pip 19.3.1
setuptools 41.6.0
wheel 0.33.6

View File

@ -0,0 +1 @@
[{"name": "pip", "version": "19.3.1", "summary": "The PyPA recommended tool for installing Python packages.", "home_page": "https://pip.pypa.io/", "author": "The pip developers", "author_email": "pypa-dev@groups.google.com", "license": "MIT", "location": "/usr/local/lib/python3.7/site-packages", "requires": null, "required_by": null}, {"name": "setuptools", "version": "41.6.0", "summary": "Easily download, build, install, upgrade, and uninstall Python packages", "home_page": "https://github.com/pypa/setuptools", "author": "Python Packaging Authority", "author_email": "distutils-sig@python.org", "license": "UNKNOWN", "location": "/usr/local/lib/python3.7/site-packages", "requires": null, "required_by": null}, {"name": "wheel", "version": "0.33.6", "summary": "A built-package format for Python.", "home_page": "https://github.com/pypa/wheel", "author": "Daniel Holth", "author_email": "dholth@fastmail.fm", "license": "MIT", "location": "/usr/local/lib/python3.7/site-packages", "requires": null, "required_by": null}]

32
tests/fixtures/osx-10.11.6/pip-show.out vendored Executable file
View File

@ -0,0 +1,32 @@
Name: pip
Version: 19.3.1
Summary: The PyPA recommended tool for installing Python packages.
Home-page: https://pip.pypa.io/
Author: The pip developers
Author-email: pypa-dev@groups.google.com
License: MIT
Location: /usr/local/lib/python3.7/site-packages
Requires:
Required-by:
---
Name: setuptools
Version: 41.6.0
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: https://github.com/pypa/setuptools
Author: Python Packaging Authority
Author-email: distutils-sig@python.org
License: UNKNOWN
Location: /usr/local/lib/python3.7/site-packages
Requires:
Required-by:
---
Name: wheel
Version: 0.33.6
Summary: A built-package format for Python.
Home-page: https://github.com/pypa/wheel
Author: Daniel Holth
Author-email: dholth@fastmail.fm
License: MIT
Location: /usr/local/lib/python3.7/site-packages
Requires:
Required-by:

View File

@ -0,0 +1 @@
[{"package": "ifconfig-parser", "version": "0.0.4"}, {"package": "jc", "version": "1.5.1"}, {"package": "pip", "version": "19.3.1"}, {"package": "setuptools", "version": "41.6.0"}, {"package": "wheel", "version": "0.33.6"}]

7
tests/fixtures/osx-10.14.6/pip-list.out vendored Executable file
View File

@ -0,0 +1,7 @@
Package Version
--------------- -------
ifconfig-parser 0.0.4
jc 1.5.1
pip 19.3.1
setuptools 41.6.0
wheel 0.33.6

View File

@ -0,0 +1 @@
[{"name": "pip", "version": "19.3.1", "summary": "The PyPA recommended tool for installing Python packages.", "home_page": "https://pip.pypa.io/", "author": "The pip developers", "author_email": "pypa-dev@groups.google.com", "license": "MIT", "location": "/usr/local/lib/python3.7/site-packages", "requires": null, "required_by": null}, {"name": "jc", "version": "1.5.1", "summary": "This tool serializes the output of popular command line tools to structured JSON output.", "home_page": "https://github.com/kellyjonbrazil/jc", "author": "Kelly Brazil", "author_email": "kellyjonbrazil@gmail.com", "license": "MIT", "location": "/usr/local/lib/python3.7/site-packages", "requires": "ifconfig-parser", "required_by": null}, {"name": "ifconfig-parser", "version": "0.0.4", "summary": "ifconfig-parser", "home_page": "https://github.com/KnightWhoSayNi/ifconfig-parser", "author": "KnightWhoSayNi", "author_email": "threeheadedknight@protonmail.com", "license": "MIT license", "location": "/usr/local/lib/python3.7/site-packages", "requires": null, "required_by": "jc"}]

32
tests/fixtures/osx-10.14.6/pip-show.out vendored Executable file
View File

@ -0,0 +1,32 @@
Name: pip
Version: 19.3.1
Summary: The PyPA recommended tool for installing Python packages.
Home-page: https://pip.pypa.io/
Author: The pip developers
Author-email: pypa-dev@groups.google.com
License: MIT
Location: /usr/local/lib/python3.7/site-packages
Requires:
Required-by:
---
Name: jc
Version: 1.5.1
Summary: This tool serializes the output of popular command line tools to structured JSON output.
Home-page: https://github.com/kellyjonbrazil/jc
Author: Kelly Brazil
Author-email: kellyjonbrazil@gmail.com
License: MIT
Location: /usr/local/lib/python3.7/site-packages
Requires: ifconfig-parser
Required-by:
---
Name: ifconfig-parser
Version: 0.0.4
Summary: ifconfig-parser
Home-page: https://github.com/KnightWhoSayNi/ifconfig-parser
Author: KnightWhoSayNi
Author-email: threeheadedknight@protonmail.com
License: MIT license
Location: /usr/local/lib/python3.7/site-packages
Requires:
Required-by: jc

View File

@ -0,0 +1 @@
[{"package": "asn1crypto", "version": "0.24.0"}, {"package": "attrs", "version": "17.4.0"}, {"package": "Automat", "version": "0.6.0"}, {"package": "blinker", "version": "1.4"}, {"package": "certifi", "version": "2018.1.18"}, {"package": "chardet", "version": "3.0.4"}, {"package": "click", "version": "6.7"}, {"package": "cloud-init", "version": "19.1"}, {"package": "colorama", "version": "0.3.7"}, {"package": "command-not-found", "version": "0.3"}, {"package": "configobj", "version": "5.0.6"}, {"package": "constantly", "version": "15.1.0"}, {"package": "cryptography", "version": "2.1.4"}, {"package": "distro-info", "version": "0.18ubuntu0.18.04.1"}, {"package": "httplib2", "version": "0.9.2"}, {"package": "hyperlink", "version": "17.3.1"}, {"package": "idna", "version": "2.6"}, {"package": "ifconfig-parser", "version": "0.0.5"}, {"package": "incremental", "version": "16.10.1"}, {"package": "jc", "version": "1.5.1"}, {"package": "Jinja2", "version": "2.10"}, {"package": "jsonpatch", "version": "1.16"}, {"package": "jsonpointer", "version": "1.10"}, {"package": "jsonschema", "version": "2.6.0"}, {"package": "keyring", "version": "10.6.0"}, {"package": "keyrings.alt", "version": "3.0"}, {"package": "language-selector", "version": "0.1"}, {"package": "MarkupSafe", "version": "1.0"}, {"package": "netifaces", "version": "0.10.4"}, {"package": "oauthlib", "version": "2.0.6"}, {"package": "PAM", "version": "0.4.2"}, {"package": "pip", "version": "9.0.1"}, {"package": "pyasn1", "version": "0.4.2"}, {"package": "pyasn1-modules", "version": "0.2.1"}, {"package": "pycrypto", "version": "2.6.1"}, {"package": "pygobject", "version": "3.26.1"}, {"package": "PyJWT", "version": "1.5.3"}, {"package": "pyOpenSSL", "version": "17.5.0"}, {"package": "pyserial", "version": "3.4"}, {"package": "python-apt", "version": "1.6.4"}, {"package": "python-debian", "version": "0.1.32"}, {"package": "pyxdg", "version": "0.25"}, {"package": "PyYAML", "version": "3.12"}, {"package": "requests", "version": "2.18.4"}, {"package": "requests-unixsocket", "version": "0.1.5"}, {"package": "SecretStorage", "version": "2.3.1"}, {"package": "service-identity", "version": "16.0.0"}, {"package": "setuptools", "version": "39.0.1"}, {"package": "six", "version": "1.11.0"}, {"package": "ssh-import-id", "version": "5.7"}, {"package": "systemd-python", "version": "234"}, {"package": "Twisted", "version": "17.9.0"}, {"package": "ufw", "version": "0.36"}, {"package": "unattended-upgrades", "version": "0.1"}, {"package": "urllib3", "version": "1.22"}, {"package": "wheel", "version": "0.30.0"}, {"package": "zope.interface", "version": "4.3.2"}]

View File

@ -0,0 +1,57 @@
asn1crypto (0.24.0)
attrs (17.4.0)
Automat (0.6.0)
blinker (1.4)
certifi (2018.1.18)
chardet (3.0.4)
click (6.7)
cloud-init (19.1)
colorama (0.3.7)
command-not-found (0.3)
configobj (5.0.6)
constantly (15.1.0)
cryptography (2.1.4)
distro-info (0.18ubuntu0.18.04.1)
httplib2 (0.9.2)
hyperlink (17.3.1)
idna (2.6)
ifconfig-parser (0.0.5)
incremental (16.10.1)
jc (1.5.1)
Jinja2 (2.10)
jsonpatch (1.16)
jsonpointer (1.10)
jsonschema (2.6.0)
keyring (10.6.0)
keyrings.alt (3.0)
language-selector (0.1)
MarkupSafe (1.0)
netifaces (0.10.4)
oauthlib (2.0.6)
PAM (0.4.2)
pip (9.0.1)
pyasn1 (0.4.2)
pyasn1-modules (0.2.1)
pycrypto (2.6.1)
pygobject (3.26.1)
PyJWT (1.5.3)
pyOpenSSL (17.5.0)
pyserial (3.4)
python-apt (1.6.4)
python-debian (0.1.32)
pyxdg (0.25)
PyYAML (3.12)
requests (2.18.4)
requests-unixsocket (0.1.5)
SecretStorage (2.3.1)
service-identity (16.0.0)
setuptools (39.0.1)
six (1.11.0)
ssh-import-id (5.7)
systemd-python (234)
Twisted (17.9.0)
ufw (0.36)
unattended-upgrades (0.1)
urllib3 (1.22)
wheel (0.30.0)
zope.interface (4.3.2)

View File

@ -0,0 +1 @@
[{"package": "asn1crypto", "version": "0.24.0"}, {"package": "attrs", "version": "17.4.0"}, {"package": "Automat", "version": "0.6.0"}, {"package": "blinker", "version": "1.4"}, {"package": "certifi", "version": "2018.1.18"}, {"package": "chardet", "version": "3.0.4"}, {"package": "click", "version": "6.7"}, {"package": "cloud-init", "version": "19.1"}, {"package": "colorama", "version": "0.3.7"}, {"package": "command-not-found", "version": "0.3"}, {"package": "configobj", "version": "5.0.6"}, {"package": "constantly", "version": "15.1.0"}, {"package": "cryptography", "version": "2.1.4"}, {"package": "distro-info", "version": "0.18ubuntu0.18.04.1"}, {"package": "httplib2", "version": "0.9.2"}, {"package": "hyperlink", "version": "17.3.1"}, {"package": "idna", "version": "2.6"}, {"package": "ifconfig-parser", "version": "0.0.5"}, {"package": "incremental", "version": "16.10.1"}, {"package": "jc", "version": "1.5.1"}, {"package": "Jinja2", "version": "2.10"}, {"package": "jsonpatch", "version": "1.16"}, {"package": "jsonpointer", "version": "1.10"}, {"package": "jsonschema", "version": "2.6.0"}, {"package": "keyring", "version": "10.6.0"}, {"package": "keyrings.alt", "version": "3.0"}, {"package": "language-selector", "version": "0.1"}, {"package": "MarkupSafe", "version": "1.0"}, {"package": "netifaces", "version": "0.10.4"}, {"package": "oauthlib", "version": "2.0.6"}, {"package": "PAM", "version": "0.4.2"}, {"package": "pip", "version": "9.0.1"}, {"package": "pyasn1", "version": "0.4.2"}, {"package": "pyasn1-modules", "version": "0.2.1"}, {"package": "pycrypto", "version": "2.6.1"}, {"package": "pygobject", "version": "3.26.1"}, {"package": "PyJWT", "version": "1.5.3"}, {"package": "pyOpenSSL", "version": "17.5.0"}, {"package": "pyserial", "version": "3.4"}, {"package": "python-apt", "version": "1.6.4"}, {"package": "python-debian", "version": "0.1.32"}, {"package": "pyxdg", "version": "0.25"}, {"package": "PyYAML", "version": "3.12"}, {"package": "requests", "version": "2.18.4"}, {"package": "requests-unixsocket", "version": "0.1.5"}, {"package": "SecretStorage", "version": "2.3.1"}, {"package": "service-identity", "version": "16.0.0"}, {"package": "setuptools", "version": "39.0.1"}, {"package": "six", "version": "1.11.0"}, {"package": "ssh-import-id", "version": "5.7"}, {"package": "systemd-python", "version": "234"}, {"package": "Twisted", "version": "17.9.0"}, {"package": "ufw", "version": "0.36"}, {"package": "unattended-upgrades", "version": "0.1"}, {"package": "urllib3", "version": "1.22"}, {"package": "wheel", "version": "0.30.0"}, {"package": "zope.interface", "version": "4.3.2"}]

View File

@ -0,0 +1,59 @@
Package Version
------------------- -------------------
asn1crypto 0.24.0
attrs 17.4.0
Automat 0.6.0
blinker 1.4
certifi 2018.1.18
chardet 3.0.4
click 6.7
cloud-init 19.1
colorama 0.3.7
command-not-found 0.3
configobj 5.0.6
constantly 15.1.0
cryptography 2.1.4
distro-info 0.18ubuntu0.18.04.1
httplib2 0.9.2
hyperlink 17.3.1
idna 2.6
ifconfig-parser 0.0.5
incremental 16.10.1
jc 1.5.1
Jinja2 2.10
jsonpatch 1.16
jsonpointer 1.10
jsonschema 2.6.0
keyring 10.6.0
keyrings.alt 3.0
language-selector 0.1
MarkupSafe 1.0
netifaces 0.10.4
oauthlib 2.0.6
PAM 0.4.2
pip 9.0.1
pyasn1 0.4.2
pyasn1-modules 0.2.1
pycrypto 2.6.1
pygobject 3.26.1
PyJWT 1.5.3
pyOpenSSL 17.5.0
pyserial 3.4
python-apt 1.6.4
python-debian 0.1.32
pyxdg 0.25
PyYAML 3.12
requests 2.18.4
requests-unixsocket 0.1.5
SecretStorage 2.3.1
service-identity 16.0.0
setuptools 39.0.1
six 1.11.0
ssh-import-id 5.7
systemd-python 234
Twisted 17.9.0
ufw 0.36
unattended-upgrades 0.1
urllib3 1.22
wheel 0.30.0
zope.interface 4.3.2

View File

@ -0,0 +1 @@
[{"name": "pycrypto", "version": "2.6.1", "summary": "Cryptographic modules for Python.", "home_page": "http://www.pycrypto.org/", "author": "Dwayne C. Litzenberger", "author_email": "dlitz@dlitz.net", "license": "UNKNOWN", "location": "/usr/lib/python3/dist-packages", "requires": null}, {"name": "six", "version": "1.11.0", "summary": "Python 2 and 3 compatibility utilities", "home_page": "http://pypi.python.org/pypi/six/", "author": "Benjamin Peterson", "author_email": "benjamin@python.org", "license": "MIT", "location": "/usr/lib/python3/dist-packages", "requires": null}, {"name": "wheel", "version": "0.30.0", "summary": "A built-package format for Python.", "home_page": "https://github.com/pypa/wheel", "author": "Alex Gr\u00f6nholm", "author_email": "alex.gronholm@nextday.fi", "license": "MIT", "location": "/usr/lib/python3/dist-packages", "requires": null}]

View File

@ -0,0 +1,29 @@
Name: pycrypto
Version: 2.6.1
Summary: Cryptographic modules for Python.
Home-page: http://www.pycrypto.org/
Author: Dwayne C. Litzenberger
Author-email: dlitz@dlitz.net
License: UNKNOWN
Location: /usr/lib/python3/dist-packages
Requires:
---
Name: six
Version: 1.11.0
Summary: Python 2 and 3 compatibility utilities
Home-page: http://pypi.python.org/pypi/six/
Author: Benjamin Peterson
Author-email: benjamin@python.org
License: MIT
Location: /usr/lib/python3/dist-packages
Requires:
---
Name: wheel
Version: 0.30.0
Summary: A built-package format for Python.
Home-page: https://github.com/pypa/wheel
Author: Alex Grönholm
Author-email: alex.gronholm@nextday.fi
License: MIT
Location: /usr/lib/python3/dist-packages
Requires:

76
tests/test_pip_list.py Normal file
View File

@ -0,0 +1,76 @@
import os
import json
import unittest
import jc.parsers.pip_list
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
class MyTests(unittest.TestCase):
def setUp(self):
# input
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/pip-list.out'), 'r') as f:
self.centos_7_7_pip_list = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/pip-list.out'), 'r') as f:
self.ubuntu_18_4_pip_list = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/pip-list-legacy.out'), 'r') as f:
self.ubuntu_18_4_pip_list_legacy = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.11.6/pip-list.out'), 'r') as f:
self.osx_10_11_6_pip_list = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/pip-list.out'), 'r') as f:
self.osx_10_14_6_pip_list = f.read()
# output
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/pip-list.json'), 'r') as f:
self.centos_7_7_pip_list_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/pip-list.json'), 'r') as f:
self.ubuntu_18_4_pip_list_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/pip-list-legacy.json'), 'r') as f:
self.ubuntu_18_4_pip_list_legacy_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.11.6/pip-list.json'), 'r') as f:
self.osx_10_11_6_pip_list_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/pip-list.json'), 'r') as f:
self.osx_10_14_6_pip_list_json = json.loads(f.read())
def test_pip_list_centos_7_7(self):
"""
Test 'pip_list' on Centos 7.7
"""
self.assertEqual(jc.parsers.pip_list.parse(self.centos_7_7_pip_list, quiet=True), self.centos_7_7_pip_list_json)
def test_pip_list_ubuntu_18_4(self):
"""
Test 'pip_list' on Ubuntu 18.4
"""
self.assertEqual(jc.parsers.pip_list.parse(self.ubuntu_18_4_pip_list, quiet=True), self.ubuntu_18_4_pip_list_json)
def test_pip_list_legacy_ubuntu_18_4(self):
"""
Test 'pip_list' with legacy output on Ubuntu 18.4
"""
self.assertEqual(jc.parsers.pip_list.parse(self.ubuntu_18_4_pip_list_legacy, quiet=True), self.ubuntu_18_4_pip_list_legacy_json)
def test_pip_list_osx_10_11_6(self):
"""
Test 'pip_list' on OSX 10.11.6
"""
self.assertEqual(jc.parsers.pip_list.parse(self.osx_10_11_6_pip_list, quiet=True), self.osx_10_11_6_pip_list_json)
def test_pip_list_osx_10_14_6(self):
"""
Test 'pip_list' on OSX 10.14.6
"""
self.assertEqual(jc.parsers.pip_list.parse(self.osx_10_14_6_pip_list, quiet=True), self.osx_10_14_6_pip_list_json)
if __name__ == '__main__':
unittest.main()

64
tests/test_pip_show.py Normal file
View File

@ -0,0 +1,64 @@
import os
import json
import unittest
import jc.parsers.pip_show
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
class MyTests(unittest.TestCase):
def setUp(self):
# input
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/pip-show.out'), 'r') as f:
self.centos_7_7_pip_show = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/pip-show.out'), 'r') as f:
self.ubuntu_18_4_pip_show = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.11.6/pip-show.out'), 'r') as f:
self.osx_10_11_6_pip_show = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/pip-show.out'), 'r') as f:
self.osx_10_14_6_pip_show = f.read()
# output
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/pip-show.json'), 'r') as f:
self.centos_7_7_pip_show_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/pip-show.json'), 'r') as f:
self.ubuntu_18_4_pip_show_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.11.6/pip-show.json'), 'r') as f:
self.osx_10_11_6_pip_show_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/pip-show.json'), 'r') as f:
self.osx_10_14_6_pip_show_json = json.loads(f.read())
def test_pip_show_centos_7_7(self):
"""
Test 'pip show' on Centos 7.7
"""
self.assertEqual(jc.parsers.pip_show.parse(self.centos_7_7_pip_show, quiet=True), self.centos_7_7_pip_show_json)
def test_pip_show_ubuntu_18_4(self):
"""
Test 'pip show' on Ubuntu 18.4
"""
self.assertEqual(jc.parsers.pip_show.parse(self.ubuntu_18_4_pip_show, quiet=True), self.ubuntu_18_4_pip_show_json)
def test_pip_show_osx_10_11_6(self):
"""
Test 'pip show' on OSX 10.11.6
"""
self.assertEqual(jc.parsers.pip_show.parse(self.osx_10_11_6_pip_show, quiet=True), self.osx_10_11_6_pip_show_json)
def test_pip_show_osx_10_14_6(self):
"""
Test 'pip show' on OSX 10.14.6
"""
self.assertEqual(jc.parsers.pip_show.parse(self.osx_10_14_6_pip_show, quiet=True), self.osx_10_14_6_pip_show_json)
if __name__ == '__main__':
unittest.main()