mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-08-08 22:36:48 +02:00
add apt_cache_show tests and fix parser name in warning messeages for parser aliases
This commit is contained in:
180
docs/parsers/apt_cache_show.md
Normal file
180
docs/parsers/apt_cache_show.md
Normal file
@ -0,0 +1,180 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.apt_cache_show"></a>
|
||||
|
||||
# jc.parsers.apt\_cache\_show
|
||||
|
||||
jc - JSON Convert `apt-cache show` command parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ apt-cache show | jc --apt-cache-show
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('apt_cache_show', apt_cache_show_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"package": string,
|
||||
"version": string,
|
||||
"installed_size": integer,
|
||||
"maintainer": string,
|
||||
"architecture": string,
|
||||
"depends": [
|
||||
string
|
||||
],
|
||||
"pre_depends": [
|
||||
string
|
||||
],
|
||||
"recommends": [
|
||||
string
|
||||
],
|
||||
"suggests": [
|
||||
string
|
||||
],
|
||||
"conflicts": [
|
||||
string
|
||||
],
|
||||
"breaks": [
|
||||
string
|
||||
],
|
||||
"description_md5": string,
|
||||
"multi_arch": string,
|
||||
"homepage": string,
|
||||
"section": string,
|
||||
"priority": string,
|
||||
"filename": string,
|
||||
"size": integer,
|
||||
"sha256": string,
|
||||
"description": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ apt-cache show | jc --apt-cache-show -p
|
||||
[
|
||||
{
|
||||
"package": "systemd",
|
||||
"version": "247.3-6~bpo10+1",
|
||||
"installed_size": 16121,
|
||||
"maintainer": "Debian systemd Maintainers <pkg-systemd-maintaine..",
|
||||
"architecture": "amd64",
|
||||
"depends": [
|
||||
"libacl1 (>= 2.2.23)",
|
||||
"libapparmor1 (>= 2.13)",
|
||||
"libaudit1 (>= 1:2.2.1)",
|
||||
"libcap2 (>= 1:2.10)",
|
||||
"libcryptsetup12 (>= 2:2.0.1)",
|
||||
"libgnutls30 (>= 3.6.6)",
|
||||
"libgpg-error0 (>= 1.14)",
|
||||
"libip4tc0 (>= 1.6.0+snapshot20161117)",
|
||||
"libkmod2 (>= 5~)",
|
||||
"liblz4-1 (>= 0.0~r130)",
|
||||
"libmount1 (>= 2.30)",
|
||||
"libpam0g (>= 0.99.7.1)",
|
||||
"libseccomp2 (>= 2.3.1)",
|
||||
"libsystemd0 (= 247.3-6~bpo10+1)",
|
||||
"systemd-timesyncd | time-daemon",
|
||||
"util-linux (>= 2.27.1)",
|
||||
"mount (>= 2.26)",
|
||||
"adduser"
|
||||
],
|
||||
"pre_depends": [
|
||||
"libblkid1 (>= 2.24)",
|
||||
"libc6 (>= 2.28)",
|
||||
"libgcrypt20 (>= 1.8.0)",
|
||||
"liblz4-1 (>= 0.0~r122)",
|
||||
"liblzma5 (>= 5.1.1alpha+20120614)",
|
||||
"libselinux1 (>= 2.1.9)",
|
||||
"libzstd1 (>= 1.4.0)"
|
||||
],
|
||||
"recommends": [
|
||||
"dbus"
|
||||
],
|
||||
"suggests": [
|
||||
"systemd-container",
|
||||
"policykit-1"
|
||||
],
|
||||
"conflicts": [
|
||||
"consolekit",
|
||||
"libpam-ck-connector"
|
||||
],
|
||||
"breaks": [
|
||||
"python-dbusmock (<< 0.18)",
|
||||
"python3-dbusmock (<< 0.18)",
|
||||
"resolvconf (<< 1.83~)",
|
||||
"systemd-shim (<< 10-4~)",
|
||||
"udev (<< 247~)"
|
||||
],
|
||||
"description_md5": "19399579cbc0c47a303288bf15eadcd4",
|
||||
"multi_arch": "foreign",
|
||||
"homepage": "https://www.freedesktop.org/wiki/Software/systemd",
|
||||
"section": "admin",
|
||||
"priority": "important",
|
||||
"filename": "pool/main/s/systemd/systemd_247.3-6~bpo10+1_amd64.deb",
|
||||
"size": 4382056,
|
||||
"sha256": "2035450655ad02faa0f75dc952128b503e51df5795c67273c0f6...",
|
||||
"description": "system and service manager systemd is a system..."
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
$ apt-cache show | jc --apt-cache-show -p -r
|
||||
[
|
||||
{
|
||||
"package": "systemd",
|
||||
"version": "247.3-6~bpo10+1",
|
||||
"installed_size": "16121",
|
||||
"maintainer": "Debian systemd Maintainers <pkg-systemd-maintain...",
|
||||
"architecture": "amd64",
|
||||
"depends": "libacl1 (>= 2.2.23), libapparmor1 (>= 2.13), libaud...",
|
||||
"pre_depends": "libblkid1 (>= 2.24), libc6 (>= 2.28), libgcrypt...",
|
||||
"recommends": "dbus",
|
||||
"suggests": "systemd-container, policykit-1",
|
||||
"conflicts": "consolekit, libpam-ck-connector",
|
||||
"breaks": "python-dbusmock (<< 0.18), python3-dbusmock (<< 0.18...",
|
||||
"description_md5": "19399579cbc0c47a303288bf15eadcd4",
|
||||
"multi_arch": "foreign",
|
||||
"homepage": "https://www.freedesktop.org/wiki/Software/systemd",
|
||||
"section": "admin",
|
||||
"priority": "important",
|
||||
"filename": "pool/main/s/systemd/systemd_247.3-6~bpo10+1_amd64.deb",
|
||||
"size": "4382056",
|
||||
"sha256": "2035450655ad02faa0f75dc952128b503e51df5795c67273c0f6...",
|
||||
"description": "system and service manager systemd is a system..."
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.apt_cache_show.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str,
|
||||
raw: bool = False,
|
||||
quiet: bool = False) -> List[JSONDictType]
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/apt_cache_show.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/apt_cache_show.py)
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
@ -81,4 +81,4 @@ Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/kv.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/kv.py)
|
||||
|
||||
Version 2.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Version 2.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -88,4 +88,4 @@ Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/kv_dup.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/kv_dup.py)
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -60,4 +60,4 @@ Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/lsb_release.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/lsb_release.py)
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -85,4 +85,4 @@ Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/os_release.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/os_release.py)
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -185,4 +185,5 @@ def parse(
|
||||
"""
|
||||
# This parser is an alias of rpm_qi.py
|
||||
rpm_qi.info = info # type: ignore
|
||||
rpm_qi.__name__ = __name__
|
||||
return rpm_qi.parse(data, raw, quiet)
|
||||
|
@ -56,7 +56,7 @@ import jc.parsers.ini as ini
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '2.1'
|
||||
version = '2.2'
|
||||
description = 'Key/Value file and string parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
@ -84,4 +84,5 @@ def parse(data, raw=False, quiet=False):
|
||||
"""
|
||||
# This parser is an alias of ini.py
|
||||
ini.info = info # type: ignore
|
||||
ini.__name__ = __name__
|
||||
return ini.parse(data, raw, quiet)
|
||||
|
@ -63,7 +63,7 @@ import jc.parsers.ini_dup as ini_dup
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '1.0'
|
||||
version = '1.1'
|
||||
description = 'Key/Value with duplicate key file and string parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
@ -91,4 +91,5 @@ def parse(data, raw=False, quiet=False):
|
||||
"""
|
||||
# This parser is an alias of ini_dup.py
|
||||
ini_dup.info = info # type: ignore
|
||||
ini_dup.__name__ = __name__
|
||||
return ini_dup.parse(data, raw, quiet)
|
||||
|
@ -36,7 +36,7 @@ import jc.parsers.ini as ini
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '1.1'
|
||||
version = '1.2'
|
||||
description = '`lsb_release` command parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
@ -69,4 +69,5 @@ def parse(
|
||||
"""
|
||||
# This parser is an alias of ini.py
|
||||
ini.info = info # type: ignore
|
||||
ini.__name__ = __name__
|
||||
return ini.parse(data, raw, quiet)
|
||||
|
@ -61,7 +61,7 @@ import jc.parsers.ini as ini
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '1.1'
|
||||
version = '1.2'
|
||||
description = '`/etc/os-release` file parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
@ -93,4 +93,5 @@ def parse(
|
||||
"""
|
||||
# This parser is an alias of ini.py
|
||||
ini.info = info # type: ignore
|
||||
ini.__name__ = __name__
|
||||
return ini.parse(data, raw, quiet)
|
||||
|
@ -159,4 +159,5 @@ def parse(
|
||||
"""
|
||||
# This parser is an alias of rpm_qi.py
|
||||
rpm_qi.info = info # type: ignore
|
||||
rpm_qi.__name__ = __name__
|
||||
return rpm_qi.parse(data, raw, quiet)
|
||||
|
1
tests/fixtures/generic/apt_cache_show--standard.json
vendored
Normal file
1
tests/fixtures/generic/apt_cache_show--standard.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
[{"package":"systemd","version":"247.3-6~bpo10+1","installed_size":16121,"maintainer":"Debian systemd Maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>","architecture":"amd64","depends":["libacl1 (>= 2.2.23)","libapparmor1 (>= 2.13)","libaudit1 (>= 1:2.2.1)","libcap2 (>= 1:2.10)","libcryptsetup12 (>= 2:2.0.1)","libgnutls30 (>= 3.6.6)","libgpg-error0 (>= 1.14)","libip4tc0 (>= 1.6.0+snapshot20161117)","libkmod2 (>= 5~)","liblz4-1 (>= 0.0~r130)","libmount1 (>= 2.30)","libpam0g (>= 0.99.7.1)","libseccomp2 (>= 2.3.1)","libsystemd0 (= 247.3-6~bpo10+1)","systemd-timesyncd | time-daemon","util-linux (>= 2.27.1)","mount (>= 2.26)","adduser"],"pre_depends":["libblkid1 (>= 2.24)","libc6 (>= 2.28)","libgcrypt20 (>= 1.8.0)","liblz4-1 (>= 0.0~r122)","liblzma5 (>= 5.1.1alpha+20120614)","libselinux1 (>= 2.1.9)","libzstd1 (>= 1.4.0)"],"recommends":["dbus"],"suggests":["systemd-container","policykit-1"],"conflicts":["consolekit","libpam-ck-connector"],"breaks":["python-dbusmock (<< 0.18)","python3-dbusmock (<< 0.18)","resolvconf (<< 1.83~)","systemd-shim (<< 10-4~)","udev (<< 247~)"],"description_md5":"19399579cbc0c47a303288bf15eadcd4","multi_arch":"foreign","homepage":"https://www.freedesktop.org/wiki/Software/systemd","section":"admin","priority":"important","filename":"pool/main/s/systemd/systemd_247.3-6~bpo10+1_amd64.deb","size":4382056,"sha256":"2035450655ad02faa0f75dc952128b503e51df5795c67273c0f62e75c509dcb0","description":"system and service manager systemd is a system and service manager for Linux. It provides aggressive parallelization capabilities, uses socket and D-Bus activation for starting services, offers on-demand starting of daemons, keeps track of processes using Linux control groups, maintains mount and automount points and implements an elaborate transactional dependency-based service control logic. . systemd is compatible with SysV and LSB init scripts and can work as a drop-in replacement for sysvinit. . Installing the systemd package will not switch your init system unless you boot with init=/lib/systemd/systemd or install systemd-sysv in addition."},{"package":"systemd","version":"241-7~deb10u8","installed_size":13484,"maintainer":"Debian systemd Maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>","architecture":"amd64","replaces":["udev (<< 228-5)"],"depends":["libacl1 (>= 2.2.23)","libapparmor1 (>= 2.9.0-3+exp2)","libaudit1 (>= 1:2.2.1)","libcap2 (>= 1:2.10)","libcryptsetup12 (>= 2:1.6.0)","libgnutls30 (>= 3.6.6)","libgpg-error0 (>= 1.14)","libidn11 (>= 1.13)","libip4tc0 (>= 1.6.0+snapshot20161117)","libkmod2 (>= 5~)","liblz4-1 (>= 0.0~r130)","libmount1 (>= 2.30)","libpam0g (>= 0.99.7.1)","libseccomp2 (>= 2.3.1)","libsystemd0 (= 241-7~deb10u8)","util-linux (>= 2.27.1)","mount (>= 2.26)","adduser"],"pre_depends":["libblkid1 (>= 2.24)","libc6 (>= 2.28)","libgcrypt20 (>= 1.8.0)","liblz4-1 (>= 0.0~r122)","liblzma5 (>= 5.1.1alpha+20120614)","libselinux1 (>= 2.1.9)"],"recommends":["libpam-systemd","dbus"],"suggests":["systemd-container","policykit-1"],"conflicts":["consolekit","libpam-ck-connector"],"breaks":["apparmor (<< 2.9.2-1)","ifupdown (<< 0.8.5~)","laptop-mode-tools (<< 1.68~)","python-dbusmock (<< 0.18)","python3-dbusmock (<< 0.18)","systemd-shim (<< 10-4~)","udev (<< 228-5)"],"description_md5":"00afa0c6fd35cc93a91e4654874648cb","multi_arch":"foreign","homepage":"https://www.freedesktop.org/wiki/Software/systemd","tag":["admin::boot","implemented-in::c","interface::daemon","role::program"],"section":"admin","priority":"important","filename":"pool/main/s/systemd/systemd_241-7~deb10u8_amd64.deb","size":3496060,"md5sum":"51a8de8b75a388c4965baf50ca788897","sha256":"a60a47ef65cf1d5680555b749a22e679c2889095df10031a6321771e70e9ce4d","description":"system and service manager systemd is a system and service manager for Linux. It provides aggressive parallelization capabilities, uses socket and D-Bus activation for starting services, offers on-demand starting of daemons, keeps track of processes using Linux control groups, maintains mount and automount points and implements an elaborate transactional dependency-based service control logic. . systemd is compatible with SysV and LSB init scripts and can work as a drop-in replacement for sysvinit. . Installing the systemd package will not switch your init system unless you boot with init=/bin/systemd or install systemd-sysv in addition. works-with::software:running"}]
|
67
tests/fixtures/generic/apt_cache_show--standard.out
vendored
Normal file
67
tests/fixtures/generic/apt_cache_show--standard.out
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
Package: systemd
|
||||
Version: 247.3-6~bpo10+1
|
||||
Installed-Size: 16121
|
||||
Maintainer: Debian systemd Maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>
|
||||
Architecture: amd64
|
||||
Depends: libacl1 (>= 2.2.23), libapparmor1 (>= 2.13), libaudit1 (>= 1:2.2.1), libcap2 (>= 1:2.10), libcryptsetup12 (>= 2:2.0.1), libgnutls30 (>= 3.6.6), libgpg-error0 (>= 1.14), libip4tc0 (>= 1.6.0+snapshot20161117), libkmod2 (>= 5~), liblz4-1 (>= 0.0~r130), libmount1 (>= 2.30), libpam0g (>= 0.99.7.1), libseccomp2 (>= 2.3.1), libsystemd0 (= 247.3-6~bpo10+1), systemd-timesyncd | time-daemon, util-linux (>= 2.27.1), mount (>= 2.26), adduser
|
||||
Pre-Depends: libblkid1 (>= 2.24), libc6 (>= 2.28), libgcrypt20 (>= 1.8.0), liblz4-1 (>= 0.0~r122), liblzma5 (>= 5.1.1alpha+20120614), libselinux1 (>= 2.1.9), libzstd1 (>= 1.4.0)
|
||||
Recommends: dbus
|
||||
Suggests: systemd-container, policykit-1
|
||||
Conflicts: consolekit, libpam-ck-connector
|
||||
Breaks: python-dbusmock (<< 0.18), python3-dbusmock (<< 0.18), resolvconf (<< 1.83~), systemd-shim (<< 10-4~), udev (<< 247~)
|
||||
Description-en: system and service manager
|
||||
systemd is a system and service manager for Linux. It provides aggressive
|
||||
parallelization capabilities, uses socket and D-Bus activation for starting
|
||||
services, offers on-demand starting of daemons, keeps track of processes using
|
||||
Linux control groups, maintains mount and automount points and implements an
|
||||
elaborate transactional dependency-based service control logic.
|
||||
.
|
||||
systemd is compatible with SysV and LSB init scripts and can work as a
|
||||
drop-in replacement for sysvinit.
|
||||
.
|
||||
Installing the systemd package will not switch your init system unless you
|
||||
boot with init=/lib/systemd/systemd or install systemd-sysv in addition.
|
||||
Description-md5: 19399579cbc0c47a303288bf15eadcd4
|
||||
Multi-Arch: foreign
|
||||
Homepage: https://www.freedesktop.org/wiki/Software/systemd
|
||||
Section: admin
|
||||
Priority: important
|
||||
Filename: pool/main/s/systemd/systemd_247.3-6~bpo10+1_amd64.deb
|
||||
Size: 4382056
|
||||
SHA256: 2035450655ad02faa0f75dc952128b503e51df5795c67273c0f62e75c509dcb0
|
||||
|
||||
Package: systemd
|
||||
Version: 241-7~deb10u8
|
||||
Installed-Size: 13484
|
||||
Maintainer: Debian systemd Maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>
|
||||
Architecture: amd64
|
||||
Replaces: udev (<< 228-5)
|
||||
Depends: libacl1 (>= 2.2.23), libapparmor1 (>= 2.9.0-3+exp2), libaudit1 (>= 1:2.2.1), libcap2 (>= 1:2.10), libcryptsetup12 (>= 2:1.6.0), libgnutls30 (>= 3.6.6), libgpg-error0 (>= 1.14), libidn11 (>= 1.13), libip4tc0 (>= 1.6.0+snapshot20161117), libkmod2 (>= 5~), liblz4-1 (>= 0.0~r130), libmount1 (>= 2.30), libpam0g (>= 0.99.7.1), libseccomp2 (>= 2.3.1), libsystemd0 (= 241-7~deb10u8), util-linux (>= 2.27.1), mount (>= 2.26), adduser
|
||||
Pre-Depends: libblkid1 (>= 2.24), libc6 (>= 2.28), libgcrypt20 (>= 1.8.0), liblz4-1 (>= 0.0~r122), liblzma5 (>= 5.1.1alpha+20120614), libselinux1 (>= 2.1.9)
|
||||
Recommends: libpam-systemd, dbus
|
||||
Suggests: systemd-container, policykit-1
|
||||
Conflicts: consolekit, libpam-ck-connector
|
||||
Breaks: apparmor (<< 2.9.2-1), ifupdown (<< 0.8.5~), laptop-mode-tools (<< 1.68~), python-dbusmock (<< 0.18), python3-dbusmock (<< 0.18), systemd-shim (<< 10-4~), udev (<< 228-5)
|
||||
Description-en: system and service manager
|
||||
systemd is a system and service manager for Linux. It provides aggressive
|
||||
parallelization capabilities, uses socket and D-Bus activation for starting
|
||||
services, offers on-demand starting of daemons, keeps track of processes using
|
||||
Linux control groups, maintains mount and automount points and implements an
|
||||
elaborate transactional dependency-based service control logic.
|
||||
.
|
||||
systemd is compatible with SysV and LSB init scripts and can work as a
|
||||
drop-in replacement for sysvinit.
|
||||
.
|
||||
Installing the systemd package will not switch your init system unless you
|
||||
boot with init=/bin/systemd or install systemd-sysv in addition.
|
||||
Description-md5: 00afa0c6fd35cc93a91e4654874648cb
|
||||
Multi-Arch: foreign
|
||||
Homepage: https://www.freedesktop.org/wiki/Software/systemd
|
||||
Tag: admin::boot, implemented-in::c, interface::daemon, role::program,
|
||||
works-with::software:running
|
||||
Section: admin
|
||||
Priority: important
|
||||
Filename: pool/main/s/systemd/systemd_241-7~deb10u8_amd64.deb
|
||||
Size: 3496060
|
||||
MD5sum: 51a8de8b75a388c4965baf50ca788897
|
||||
SHA256: a60a47ef65cf1d5680555b749a22e679c2889095df10031a6321771e70e9ce4d
|
28
tests/test_apt_cache_show.py
Normal file
28
tests/test_apt_cache_show.py
Normal file
@ -0,0 +1,28 @@
|
||||
import unittest
|
||||
|
||||
from tests import utils_for_test as test_utils
|
||||
|
||||
# Execute these steps for standard tests:
|
||||
# - Save this file as `test_{parser_name}.py` since the helper methods extract parser names from the filename.
|
||||
# - Organize fixtures in `tests/fixtures` for optimal structure.
|
||||
# - Format fixtures as follows (using double dashes):
|
||||
# - `{parser_name}--{some_test_description}.out` for command output.
|
||||
# - `{parser_name}--{some_test_description}.json` for expected JSON after parsing.
|
||||
|
||||
class MyTests(unittest.TestCase):
|
||||
|
||||
def test_apt_cache_show_nodata(self):
|
||||
"""
|
||||
Test 'apt_cache_show' with no data
|
||||
"""
|
||||
test_utils.run_no_data(self, __file__, [])
|
||||
|
||||
def test_apt_cache_show_all_fixtures(self):
|
||||
"""
|
||||
Test 'apt_cache_show' with various fixtures
|
||||
"""
|
||||
test_utils.run_all_fixtures(self, __file__)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Reference in New Issue
Block a user