summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gabriel@inconstante.net.br>2020-01-24 19:24:09 -0300
committerGabriel F. T. Gomes <gabriel@inconstante.net.br>2020-01-24 19:24:09 -0300
commit019f3cc463db63abc6460f97deb488deec43840b (patch)
tree08cd5387d6c8af6f688d6468c7e2ae9f25c449be /test
parent5732da2af736c40cf693354485446ab4867ecb4d (diff)
downloadbash-completion-019f3cc463db63abc6460f97deb488deec43840b.tar.gz
New upstream version 2.10upstream/2.10
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am1
-rw-r--r--test/config/bashrc44
-rw-r--r--test/docker/Dockerfile6
-rw-r--r--test/docker/Dockerfile-centos611
-rw-r--r--test/docker/Dockerfile-fedoradev11
-rw-r--r--test/docker/Dockerfile-tools3
-rw-r--r--test/docker/Dockerfile-ubuntu1413
-rwxr-xr-xtest/docker/docker-script.sh10
-rw-r--r--test/fixtures/shared/.ssh/known_hosts1
-rw-r--r--test/fixtures/tox/tox.ini6
-rw-r--r--test/lib/completions/finger.exp7
-rw-r--r--test/lib/library.exp32
-rw-r--r--test/requirements.txt4
-rwxr-xr-xtest/runLint2
-rw-r--r--test/setup.cfg9
-rw-r--r--test/t/Makefile.am11
-rw-r--r--test/t/conftest.py81
-rw-r--r--test/t/test_2to3.py4
-rw-r--r--test/t/test_7z.py2
-rw-r--r--test/t/test_a2ps.py4
-rw-r--r--test/t/test_a2x.py4
-rw-r--r--test/t/test_abook.py2
-rw-r--r--test/t/test_aclocal.py4
-rw-r--r--test/t/test_acpi.py2
-rw-r--r--test/t/test_acroread.py2
-rw-r--r--test/t/test_adb.py4
-rw-r--r--test/t/test_alpine.py2
-rw-r--r--test/t/test_ant.py2
-rw-r--r--test/t/test_appdata_validate.py4
-rw-r--r--test/t/test_apt_cache.py2
-rw-r--r--test/t/test_arch.py2
-rw-r--r--test/t/test_arp.py9
-rw-r--r--test/t/test_arping.py2
-rw-r--r--test/t/test_arpspoof.py2
-rw-r--r--test/t/test_asciidoc.py4
-rw-r--r--test/t/test_automake.py4
-rw-r--r--test/t/test_autoscan.py4
-rw-r--r--test/t/test_autossh.py7
-rw-r--r--test/t/test_awk.py4
-rw-r--r--test/t/test_badblocks.py5
-rw-r--r--test/t/test_base64.py4
-rw-r--r--test/t/test_bash.py2
-rw-r--r--test/t/test_bc.py2
-rw-r--r--test/t/test_bind.py2
-rw-r--r--test/t/test_bison.py2
-rw-r--r--test/t/test_bzip2.py4
-rw-r--r--test/t/test_cal.py4
-rw-r--r--test/t/test_carton.py11
-rw-r--r--test/t/test_cat.py4
-rw-r--r--test/t/test_ccache.py10
-rw-r--r--test/t/test_ccze.py4
-rw-r--r--test/t/test_cfagent.py2
-rw-r--r--test/t/test_chage.py4
-rw-r--r--test/t/test_checksec.py2
-rw-r--r--test/t/test_chkconfig.py2
-rw-r--r--test/t/test_chmod.py2
-rw-r--r--test/t/test_chpasswd.py2
-rw-r--r--test/t/test_chromium_browser.py14
-rw-r--r--test/t/test_chronyc.py4
-rw-r--r--test/t/test_chroot.py4
-rw-r--r--test/t/test_chrpath.py2
-rw-r--r--test/t/test_chsh.py4
-rw-r--r--test/t/test_civclient.py2
-rw-r--r--test/t/test_civserver.py2
-rw-r--r--test/t/test_cksfv.py2
-rw-r--r--test/t/test_colordiff.py11
-rw-r--r--test/t/test_compgen.py7
-rw-r--r--test/t/test_configure.py2
-rw-r--r--test/t/test_convert.py4
-rw-r--r--test/t/test_cp.py4
-rw-r--r--test/t/test_cpan2dist.py2
-rw-r--r--test/t/test_cpio.py6
-rw-r--r--test/t/test_cppcheck.py2
-rw-r--r--test/t/test_createdb.py4
-rw-r--r--test/t/test_createuser.py2
-rw-r--r--test/t/test_cryptsetup.py4
-rw-r--r--test/t/test_csplit.py4
-rw-r--r--test/t/test_curl.py11
-rw-r--r--test/t/test_cut.py4
-rw-r--r--test/t/test_cvs.py4
-rw-r--r--test/t/test_cvsps.py2
-rw-r--r--test/t/test_date.py4
-rw-r--r--test/t/test_dcop.py11
-rw-r--r--test/t/test_dd.py8
-rw-r--r--test/t/test_declare.py4
-rw-r--r--test/t/test_deja_dup.py2
-rw-r--r--test/t/test_desktop_file_validate.py4
-rw-r--r--test/t/test_df.py4
-rw-r--r--test/t/test_dhclient.py2
-rw-r--r--test/t/test_dict.py2
-rw-r--r--test/t/test_diff.py2
-rw-r--r--test/t/test_dir.py4
-rw-r--r--test/t/test_display.py2
-rw-r--r--test/t/test_dmesg.py2
-rw-r--r--test/t/test_dmypy.py12
-rw-r--r--test/t/test_dnsspoof.py2
-rw-r--r--test/t/test_dpkg.py6
-rw-r--r--test/t/test_dpkg_deb.py2
-rw-r--r--test/t/test_dropdb.py4
-rw-r--r--test/t/test_dselect.py2
-rw-r--r--test/t/test_du.py4
-rw-r--r--test/t/test_dumpe2fs.py4
-rw-r--r--test/t/test_e2freefrag.py4
-rw-r--r--test/t/test_ecryptfs_migrate_home.py6
-rw-r--r--test/t/test_eject.py2
-rw-r--r--test/t/test_enscript.py2
-rw-r--r--test/t/test_env.py2
-rw-r--r--test/t/test_eog.py4
-rw-r--r--test/t/test_ether_wake.py10
-rw-r--r--test/t/test_evince.py4
-rw-r--r--test/t/test_expand.py2
-rw-r--r--test/t/test_explodepkg.py17
-rw-r--r--test/t/test_export.py2
-rw-r--r--test/t/test_faillog.py2
-rw-r--r--test/t/test_feh.py4
-rw-r--r--test/t/test_file.py2
-rw-r--r--test/t/test_filefrag.py4
-rw-r--r--test/t/test_filesnarf.py2
-rw-r--r--test/t/test_finger.py17
-rw-r--r--test/t/test_fio.py2
-rw-r--r--test/t/test_firefox.py2
-rw-r--r--test/t/test_flake8.py5
-rw-r--r--test/t/test_fmt.py4
-rw-r--r--test/t/test_fold.py2
-rw-r--r--test/t/test_freeciv.py2
-rw-r--r--test/t/test_freeciv_server.py2
-rw-r--r--test/t/test_fusermount.py4
-rw-r--r--test/t/test_gcc.py60
-rw-r--r--test/t/test_genisoimage.py4
-rw-r--r--test/t/test_geoiplookup.py2
-rw-r--r--test/t/test_getconf.py4
-rw-r--r--test/t/test_getent.py11
-rw-r--r--test/t/test_gkrellm.py2
-rw-r--r--test/t/test_gm.py6
-rw-r--r--test/t/test_gnokii.py6
-rw-r--r--test/t/test_gnome_mplayer.py11
-rw-r--r--test/t/test_gnome_screenshot.py2
-rw-r--r--test/t/test_gpasswd.py4
-rw-r--r--test/t/test_gperf.py2
-rw-r--r--test/t/test_gpg2.py2
-rw-r--r--test/t/test_gpgv.py2
-rw-r--r--test/t/test_gphoto2.py2
-rw-r--r--test/t/test_gprof.py2
-rw-r--r--test/t/test_grep.py2
-rw-r--r--test/t/test_groupadd.py2
-rw-r--r--test/t/test_groupdel.py4
-rw-r--r--test/t/test_groupmems.py2
-rw-r--r--test/t/test_groupmod.py2
-rw-r--r--test/t/test_grpck.py2
-rw-r--r--test/t/test_grub.py2
-rw-r--r--test/t/test_gssdp_discover.py22
-rw-r--r--test/t/test_gzip.py4
-rw-r--r--test/t/test_hcitool.py4
-rw-r--r--test/t/test_head.py2
-rw-r--r--test/t/test_hexdump.py2
-rw-r--r--test/t/test_host.py2
-rw-r--r--test/t/test_hostname.py2
-rw-r--r--test/t/test_hping2.py4
-rw-r--r--test/t/test_htop.py2
-rw-r--r--test/t/test_htpasswd.py4
-rw-r--r--test/t/test_hunspell.py2
-rw-r--r--test/t/test_hwclock.py2
-rw-r--r--test/t/test_iconv.py14
-rw-r--r--test/t/test_identify.py2
-rw-r--r--test/t/test_idn.py2
-rw-r--r--test/t/test_ifdown.py4
-rw-r--r--test/t/test_ifstat.py8
-rw-r--r--test/t/test_iftop.py6
-rw-r--r--test/t/test_ifup.py8
-rw-r--r--test/t/test_influx.py15
-rw-r--r--test/t/test_info.py2
-rw-r--r--test/t/test_inotifywait.py4
-rw-r--r--test/t/test_inotifywatch.py4
-rw-r--r--test/t/test_installpkg.py6
-rw-r--r--test/t/test_interdiff.py4
-rw-r--r--test/t/test_ionice.py2
-rw-r--r--test/t/test_iperf.py10
-rw-r--r--test/t/test_iperf3.py6
-rw-r--r--test/t/test_ipmitool.py4
-rw-r--r--test/t/test_iptables.py2
-rw-r--r--test/t/test_ipv6calc.py6
-rw-r--r--test/t/test_irb.py4
-rw-r--r--test/t/test_isort.py2
-rw-r--r--test/t/test_java.py33
-rw-r--r--test/t/test_javaws.py4
-rw-r--r--test/t/test_jpegoptim.py4
-rw-r--r--test/t/test_jq.py3
-rw-r--r--test/t/test_jshint.py4
-rw-r--r--test/t/test_jsonschema.py2
-rw-r--r--test/t/test_k3b.py4
-rw-r--r--test/t/test_kcov.py2
-rw-r--r--test/t/test_kdvi.py4
-rw-r--r--test/t/test_kill.py2
-rw-r--r--test/t/test_killall.py8
-rw-r--r--test/t/test_koji.py4
-rw-r--r--test/t/test_kpdf.py2
-rw-r--r--test/t/test_l2ping.py2
-rw-r--r--test/t/test_lastlog.py2
-rw-r--r--test/t/test_ld.py4
-rw-r--r--test/t/test_ldapvi.py2
-rw-r--r--test/t/test_ldd.py4
-rw-r--r--test/t/test_less.py2
-rw-r--r--test/t/test_lftp.py4
-rw-r--r--test/t/test_links.py2
-rw-r--r--test/t/test_lintian_info.py2
-rw-r--r--test/t/test_ln.py4
-rw-r--r--test/t/test_locale_gen.py5
-rw-r--r--test/t/test_lrzip.py4
-rw-r--r--test/t/test_ls.py4
-rw-r--r--test/t/test_lspci.py4
-rw-r--r--test/t/test_lsscsi.py2
-rw-r--r--test/t/test_lsusb.py5
-rw-r--r--test/t/test_lua.py4
-rw-r--r--test/t/test_luac.py4
-rw-r--r--test/t/test_luseradd.py2
-rw-r--r--test/t/test_luserdel.py4
-rw-r--r--test/t/test_lvchange.py2
-rw-r--r--test/t/test_lvcreate.py2
-rw-r--r--test/t/test_lvdisplay.py4
-rw-r--r--test/t/test_lvextend.py2
-rw-r--r--test/t/test_lvmdiskscan.py4
-rw-r--r--test/t/test_lvreduce.py2
-rw-r--r--test/t/test_lvremove.py2
-rw-r--r--test/t/test_lvrename.py2
-rw-r--r--test/t/test_lvresize.py2
-rw-r--r--test/t/test_lvs.py4
-rw-r--r--test/t/test_lvscan.py4
-rw-r--r--test/t/test_lz4.py4
-rw-r--r--test/t/test_lzip.py4
-rw-r--r--test/t/test_m4.py4
-rw-r--r--test/t/test_macof.py2
-rw-r--r--test/t/test_mailsnarf.py2
-rw-r--r--test/t/test_make.py8
-rw-r--r--test/t/test_makepkg.py7
-rw-r--r--test/t/test_man.py31
-rw-r--r--test/t/test_mc.py2
-rw-r--r--test/t/test_mcrypt.py8
-rw-r--r--test/t/test_md5sum.py4
-rw-r--r--test/t/test_medusa.py2
-rw-r--r--test/t/test_mencoder.py2
-rw-r--r--test/t/test_mii_diag.py4
-rw-r--r--test/t/test_mii_tool.py4
-rw-r--r--test/t/test_minicom.py2
-rw-r--r--test/t/test_mkdir.py4
-rw-r--r--test/t/test_mkfifo.py4
-rw-r--r--test/t/test_mknod.py4
-rw-r--r--test/t/test_mock.py6
-rw-r--r--test/t/test_modinfo.py4
-rw-r--r--test/t/test_modprobe.py2
-rw-r--r--test/t/test_monodevelop.py4
-rw-r--r--test/t/test_mplayer.py2
-rw-r--r--test/t/test_mr.py26
-rw-r--r--test/t/test_msgsnarf.py2
-rw-r--r--test/t/test_munin_node_configure.py11
-rw-r--r--test/t/test_munin_run.py2
-rw-r--r--test/t/test_munindoc.py3
-rw-r--r--test/t/test_mussh.py2
-rw-r--r--test/t/test_mutt.py2
-rw-r--r--test/t/test_mv.py4
-rw-r--r--test/t/test_mypy.py2
-rw-r--r--test/t/test_mysqladmin.py2
-rw-r--r--test/t/test_nc.py2
-rw-r--r--test/t/test_ncftp.py2
-rw-r--r--test/t/test_nethogs.py4
-rw-r--r--test/t/test_netstat.py4
-rw-r--r--test/t/test_newlist.py2
-rw-r--r--test/t/test_newusers.py4
-rw-r--r--test/t/test_ngrep.py2
-rw-r--r--test/t/test_nl.py4
-rw-r--r--test/t/test_nm.py4
-rw-r--r--test/t/test_nproc.py8
-rw-r--r--test/t/test_nsupdate.py2
-rw-r--r--test/t/test_ntpdate.py2
-rw-r--r--test/t/test_objcopy.py4
-rw-r--r--test/t/test_od.py4
-rw-r--r--test/t/test_oggdec.py2
-rw-r--r--test/t/test_op.py4
-rw-r--r--test/t/test_opera.py4
-rw-r--r--test/t/test_optipng.py4
-rw-r--r--test/t/test_passwd.py2
-rw-r--r--test/t/test_paste.py4
-rw-r--r--test/t/test_patch.py4
-rw-r--r--test/t/test_pdftotext.py4
-rw-r--r--test/t/test_perl.py34
-rw-r--r--test/t/test_perlcritic.py4
-rw-r--r--test/t/test_perldoc.py2
-rw-r--r--test/t/test_perltidy.py6
-rw-r--r--test/t/test_pgrep.py4
-rw-r--r--test/t/test_phing.py4
-rw-r--r--test/t/test_pidof.py6
-rw-r--r--test/t/test_pine.py2
-rw-r--r--test/t/test_pinfo.py2
-rw-r--r--test/t/test_ping.py2
-rw-r--r--test/t/test_pkg_config.py2
-rw-r--r--test/t/test_pkgadd.py3
-rw-r--r--test/t/test_pkgrm.py3
-rw-r--r--test/t/test_pkill.py4
-rw-r--r--test/t/test_pngfix.py2
-rw-r--r--test/t/test_portinstall.py5
-rw-r--r--test/t/test_portupgrade.py3
-rw-r--r--test/t/test_postcat.py4
-rw-r--r--test/t/test_postconf.py6
-rw-r--r--test/t/test_postfix.py5
-rw-r--r--test/t/test_postmap.py4
-rw-r--r--test/t/test_pr.py4
-rw-r--r--test/t/test_prelink.py2
-rw-r--r--test/t/test_protoc.py4
-rw-r--r--test/t/test_psql.py4
-rw-r--r--test/t/test_ptx.py4
-rw-r--r--test/t/test_pv.py2
-rw-r--r--test/t/test_pvchange.py2
-rw-r--r--test/t/test_pvcreate.py2
-rw-r--r--test/t/test_pvdisplay.py4
-rw-r--r--test/t/test_pvmove.py4
-rw-r--r--test/t/test_pvremove.py2
-rw-r--r--test/t/test_pvs.py4
-rw-r--r--test/t/test_pvscan.py4
-rw-r--r--test/t/test_pwck.py4
-rw-r--r--test/t/test_pwd.py2
-rw-r--r--test/t/test_pwdx.py12
-rw-r--r--test/t/test_pwgen.py2
-rw-r--r--test/t/test_pycodestyle.py2
-rw-r--r--test/t/test_pydoc.py6
-rw-r--r--test/t/test_pydocstyle.py2
-rw-r--r--test/t/test_pyflakes.py4
-rw-r--r--test/t/test_pylint.py2
-rw-r--r--test/t/test_pylint_3.py2
-rw-r--r--test/t/test_python.py4
-rw-r--r--test/t/test_python3.py4
-rw-r--r--test/t/test_qemu.py4
-rw-r--r--test/t/test_querybts.py2
-rw-r--r--test/t/test_quota.py4
-rw-r--r--test/t/test_quotacheck.py2
-rw-r--r--test/t/test_quotaon.py2
-rw-r--r--test/t/test_radvdump.py6
-rw-r--r--test/t/test_rdesktop.py2
-rw-r--r--test/t/test_rdict.py2
-rw-r--r--test/t/test_readelf.py2
-rw-r--r--test/t/test_repomanage.py4
-rw-r--r--test/t/test_reportbug.py2
-rw-r--r--test/t/test_reptyr.py2
-rw-r--r--test/t/test_ri.py4
-rw-r--r--test/t/test_rm.py4
-rw-r--r--test/t/test_rmdir.py4
-rw-r--r--test/t/test_rmmod.py2
-rw-r--r--test/t/test_rpm.py4
-rw-r--r--test/t/test_rpm2tgz.py4
-rw-r--r--test/t/test_rpmbuild.py2
-rw-r--r--test/t/test_rtcwake.py6
-rw-r--r--test/t/test_sbcl_mt.py1
-rw-r--r--test/t/test_sbopkg.py2
-rw-r--r--test/t/test_screen.py26
-rw-r--r--test/t/test_scrub.py4
-rw-r--r--test/t/test_sed.py2
-rw-r--r--test/t/test_seq.py2
-rw-r--r--test/t/test_setquota.py4
-rw-r--r--test/t/test_sftp.py4
-rw-r--r--test/t/test_sha1sum.py2
-rw-r--r--test/t/test_shar.py2
-rw-r--r--test/t/test_shellcheck.py6
-rw-r--r--test/t/test_sitecopy.py2
-rw-r--r--test/t/test_slapt_get.py4
-rw-r--r--test/t/test_slapt_src.py6
-rw-r--r--test/t/test_smartctl.py2
-rw-r--r--test/t/test_smbcacls.py2
-rw-r--r--test/t/test_smbclient.py2
-rw-r--r--test/t/test_smbcquotas.py2
-rw-r--r--test/t/test_smbget.py2
-rw-r--r--test/t/test_smbpasswd.py2
-rw-r--r--test/t/test_smbtar.py2
-rw-r--r--test/t/test_smbtree.py2
-rw-r--r--test/t/test_snownews.py2
-rw-r--r--test/t/test_sort.py2
-rw-r--r--test/t/test_split.py2
-rw-r--r--test/t/test_sqlite3.py4
-rw-r--r--test/t/test_ss.py6
-rw-r--r--test/t/test_ssh.py4
-rw-r--r--test/t/test_ssh_add.py9
-rw-r--r--test/t/test_ssh_copy_id.py2
-rw-r--r--test/t/test_ssh_keygen.py2
-rw-r--r--test/t/test_sshmitm.py2
-rw-r--r--test/t/test_sshow.py2
-rw-r--r--test/t/test_strace.py2
-rw-r--r--test/t/test_strings.py4
-rw-r--r--test/t/test_strip.py2
-rw-r--r--test/t/test_su.py4
-rw-r--r--test/t/test_sudo.py2
-rw-r--r--test/t/test_sum.py11
-rw-r--r--test/t/test_synclient.py6
-rw-r--r--test/t/test_sysbench.py6
-rw-r--r--test/t/test_sysctl.py5
-rw-r--r--test/t/test_tac.py2
-rw-r--r--test/t/test_tail.py2
-rw-r--r--test/t/test_tcpdump.py2
-rw-r--r--test/t/test_tcpnice.py2
-rw-r--r--test/t/test_tee.py4
-rw-r--r--test/t/test_texindex.py2
-rw-r--r--test/t/test_timeout.py2
-rw-r--r--test/t/test_touch.py2
-rw-r--r--test/t/test_tox.py12
-rw-r--r--test/t/test_tr.py2
-rw-r--r--test/t/test_tracepath.py2
-rw-r--r--test/t/test_tshark.py10
-rw-r--r--test/t/test_tune2fs.py4
-rw-r--r--test/t/test_udevadm.py6
-rw-r--r--test/t/test_ulimit.py2
-rw-r--r--test/t/test_uname.py2
-rw-r--r--test/t/test_unexpand.py4
-rw-r--r--test/t/test_uniq.py2
-rw-r--r--test/t/test_units.py4
-rw-r--r--test/t/test_unshunt.py2
-rw-r--r--test/t/test_update_alternatives.py2
-rw-r--r--test/t/test_upgradepkg.py4
-rw-r--r--test/t/test_urlsnarf.py2
-rw-r--r--test/t/test_uscan.py2
-rw-r--r--test/t/test_useradd.py2
-rw-r--r--test/t/test_userdel.py2
-rw-r--r--test/t/test_usermod.py2
-rw-r--r--test/t/test_valgrind.py8
-rw-r--r--test/t/test_vdir.py4
-rw-r--r--test/t/test_vgcfgbackup.py4
-rw-r--r--test/t/test_vgcfgrestore.py4
-rw-r--r--test/t/test_vgchange.py4
-rw-r--r--test/t/test_vgck.py4
-rw-r--r--test/t/test_vgconvert.py2
-rw-r--r--test/t/test_vgcreate.py6
-rw-r--r--test/t/test_vgdisplay.py2
-rw-r--r--test/t/test_vgexport.py4
-rw-r--r--test/t/test_vgextend.py4
-rw-r--r--test/t/test_vgimport.py4
-rw-r--r--test/t/test_vgmerge.py4
-rw-r--r--test/t/test_vgmknodes.py2
-rw-r--r--test/t/test_vgreduce.py4
-rw-r--r--test/t/test_vgremove.py4
-rw-r--r--test/t/test_vgrename.py4
-rw-r--r--test/t/test_vgs.py4
-rw-r--r--test/t/test_vgscan.py4
-rw-r--r--test/t/test_vgsplit.py4
-rw-r--r--test/t/test_vipw.py2
-rw-r--r--test/t/test_vmstat.py2
-rw-r--r--test/t/test_vpnc.py2
-rw-r--r--test/t/test_watch.py2
-rw-r--r--test/t/test_wc.py2
-rw-r--r--test/t/test_webmitm.py2
-rw-r--r--test/t/test_wget.py2
-rw-r--r--test/t/test_who.py4
-rw-r--r--test/t/test_wol.py4
-rw-r--r--test/t/test_wsimport.py11
-rw-r--r--test/t/test_wtf.py3
-rw-r--r--test/t/test_wvdial.py2
-rw-r--r--test/t/test_xdg_settings.py4
-rw-r--r--test/t/test_xfreerdp.py14
-rw-r--r--test/t/test_xgamma.py4
-rw-r--r--test/t/test_xmllint.py2
-rw-r--r--test/t/test_xmlwf.py4
-rw-r--r--test/t/test_xmms.py2
-rw-r--r--test/t/test_xmodmap.py2
-rw-r--r--test/t/test_xrandr.py6
-rw-r--r--test/t/test_xrdb.py4
-rw-r--r--test/t/test_xsltproc.py2
-rw-r--r--test/t/test_xvfb_run.py12
-rw-r--r--test/t/test_xxd.py2
-rw-r--r--test/t/test_xz.py4
-rw-r--r--test/t/test_xzdec.py4
-rw-r--r--test/t/test_ypcat.py2
-rw-r--r--test/t/test_ypmatch.py3
-rw-r--r--test/t/test_yum.py2
-rw-r--r--test/t/test_zopfli.py4
-rw-r--r--test/t/test_zopflipng.py4
-rw-r--r--test/t/unit/Makefile.am4
-rw-r--r--test/t/unit/test_unit_filedir.py118
-rw-r--r--test/t/unit/test_unit_ip_addresses.py4
-rw-r--r--test/t/unit/test_unit_quote.py36
-rw-r--r--test/t/unit/test_unit_variables.py41
-rw-r--r--test/unit/_filedir.exp82
-rw-r--r--test/unit/_variables.exp39
-rw-r--r--test/unit/compgen.exp35
-rw-r--r--test/unit/quote.exp65
478 files changed, 1760 insertions, 798 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 454f1ecd..003ec132 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -8,6 +8,7 @@ EXTRA_DIST = completion \
config \
fixtures \
lib \
+ setup.cfg \
unit
all:
diff --git a/test/config/bashrc b/test/config/bashrc
index 69098e14..dad96335 100644
--- a/test/config/bashrc
+++ b/test/config/bashrc
@@ -1,38 +1,50 @@
-# bashrc file for DejaGnu testsuite
+# bashrc file for bash-completion test suite
# Note that we do some initialization that would be too late to do here in
-# library.exp's start_bash().
+# library.exp's start_bash() and conftest.py.
- # Use emacs key bindings
+# Use emacs key bindings
set -o emacs
- # Use bash strict mode
+
+# Use bash strict mode
set -o posix
- # Unset `command_not_found_handle' as defined on Debian/Ubuntu, because this
- # troubles and slows down testing
+
+# Unset `command_not_found_handle' as defined on Debian/Ubuntu, because this
+# troubles and slows down testing
unset -f command_not_found_handle
+
TESTDIR=$(pwd)
+
export PS2='> '
- # Also test completions of system administrator commands, which are
- # installed via the same PATH expansion in `bash_completion.have()'
+
+# Also test completions of system administrator commands, which are
+# installed via the same PATH expansion in `bash_completion.have()'
export PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
- # ...as well as games on some systems not in PATH by default:
+
+# ...as well as games on some systems not in PATH by default:
export PATH=$PATH:/usr/games:/usr/local/games
- # For clean test state, avoid sourcing user's ~/.bash_completion
+
+# For clean test state, avoid sourcing user's ~/.bash_completion
export BASH_COMPLETION_USER_FILE=/dev/null
- # ...and avoid stuff in BASH_COMPLETION_USER_DIR overriding in-tree
- # completions. The user dir is first in the lookup path, so this should also
- # give precedence to the in-tree "completions" dir over other ones, e.g.
- # the one possibly in /usr/share/bash-completion.
+
+# ...and avoid stuff in BASH_COMPLETION_USER_DIR and system install locations
+# overriding in-tree completions. Setting the user dir would otherwise suffice,
+# but simple xspec completions are only installed if a separate one is not
+# found in any completion dirs. Therefore we also point the "system" dirs to
+# locations that should not yield valid completions and helpers paths either.
export BASH_COMPLETION_USER_DIR=$(cd "$SRCDIR/.."; pwd)
+# /var/empty isn't necessarily actually always empty :P
+export BASH_COMPLETION_COMPAT_DIR=/var/empty/bash_completion.d
+export XDG_DATA_DIRS=/var/empty
- # Make sure default settings are in effect
+# Make sure default settings are in effect
unset -v \
COMP_CONFIGURE_HINTS \
COMP_CVS_REMOTE \
COMP_KNOWN_HOSTS_WITH_HOSTFILE \
COMP_TAR_INTERNAL_PATHS
- # Load bash testsuite helper functions
+# Load bash testsuite helper functions
. $SRCDIR/lib/library.sh
# Local variables:
diff --git a/test/docker/Dockerfile b/test/docker/Dockerfile
new file mode 100644
index 00000000..200f9182
--- /dev/null
+++ b/test/docker/Dockerfile
@@ -0,0 +1,6 @@
+ARG DIST
+FROM vskytta/bash-completion:$DIST
+
+WORKDIR /work
+COPY . .
+CMD ["test/docker/docker-script.sh"]
diff --git a/test/docker/Dockerfile-centos6 b/test/docker/Dockerfile-centos6
deleted file mode 100644
index 6f886ffa..00000000
--- a/test/docker/Dockerfile-centos6
+++ /dev/null
@@ -1,11 +0,0 @@
-FROM vskytta/bash-completion:centos6
-
-# When adding new completions, install packages desired for their testing here
-# in case they're not in the base image, and remove later when the base image
-# has caught up.
-#RUN yum -y install \
-# some-package
-
-WORKDIR /work
-COPY . .
-CMD ["bash"]
diff --git a/test/docker/Dockerfile-fedoradev b/test/docker/Dockerfile-fedoradev
deleted file mode 100644
index 8c4f86d7..00000000
--- a/test/docker/Dockerfile-fedoradev
+++ /dev/null
@@ -1,11 +0,0 @@
-FROM vskytta/bash-completion:fedoradev
-
-# When adding new completions, install packages desired for their testing here
-# in case they're not in the base image, and remove later when the base image
-# has caught up.
-#RUN dnf --nogpgcheck --refresh -y install \
-# some-package
-
-WORKDIR /work
-COPY . .
-CMD ["bash"]
diff --git a/test/docker/Dockerfile-tools b/test/docker/Dockerfile-tools
deleted file mode 100644
index 2328808e..00000000
--- a/test/docker/Dockerfile-tools
+++ /dev/null
@@ -1,3 +0,0 @@
-FROM vskytta/bash-completion:tools
-
-COPY . .
diff --git a/test/docker/Dockerfile-ubuntu14 b/test/docker/Dockerfile-ubuntu14
deleted file mode 100644
index a1086add..00000000
--- a/test/docker/Dockerfile-ubuntu14
+++ /dev/null
@@ -1,13 +0,0 @@
-FROM vskytta/bash-completion:ubuntu14
-
-# When adding new completions, install packages desired for their testing here
-# in case they're not in the base image, and remove later when the base image
-# has caught up.
-#RUN apt-get update \
-# && \
-# DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
-# some-package
-
-WORKDIR /work
-COPY . .
-CMD ["bash"]
diff --git a/test/docker/docker-script.sh b/test/docker/docker-script.sh
index ec310b35..681f2429 100755
--- a/test/docker/docker-script.sh
+++ b/test/docker/docker-script.sh
@@ -20,15 +20,6 @@ if [ "$BSD" ]; then
export PATH
fi
-case $DIST in
- centos6|ubuntu14)
- : ${PYTEST:=/root/.local/bin/pytest}
- ;;
- *)
- : ${PYTEST:=pytest-3}
- ;;
-esac
-
export bashcomp_bash=bash
env
@@ -37,6 +28,5 @@ autoreconf -i
make -j
xvfb-run make distcheck \
- PYTEST=$PYTEST \
PYTESTFLAGS="--numprocesses=auto --dist=loadfile" \
RUNTESTFLAGS="--all --verbose"
diff --git a/test/fixtures/shared/.ssh/known_hosts b/test/fixtures/shared/.ssh/known_hosts
new file mode 100644
index 00000000..03d444ac
--- /dev/null
+++ b/test/fixtures/shared/.ssh/known_hosts
@@ -0,0 +1 @@
+bash-completion-canary-host.local
diff --git a/test/fixtures/tox/tox.ini b/test/fixtures/tox/tox.ini
new file mode 100644
index 00000000..a64454fc
--- /dev/null
+++ b/test/fixtures/tox/tox.ini
@@ -0,0 +1,6 @@
+[tox]
+envlist = py37
+
+[testenv]
+deps = pytest
+commands = pytest
diff --git a/test/lib/completions/finger.exp b/test/lib/completions/finger.exp
index fa9f5b6b..c055f354 100644
--- a/test/lib/completions/finger.exp
+++ b/test/lib/completions/finger.exp
@@ -14,13 +14,6 @@ setup
sync_after_int
-set test "Tab should complete partial username"
-assert_complete_partial [exec bash -c "compgen -A user -S @"] "finger" "" $test -nospace
-
-
-sync_after_int
-
-
set test "Tab should complete partial hostname"
# Build string list of hostnames, starting with the character of the first
# host, unless host starts with a COMP_WORDBREAKS character, e.g. a colon (:).
diff --git a/test/lib/library.exp b/test/lib/library.exp
index 899d74b6..c90c927c 100644
--- a/test/lib/library.exp
+++ b/test/lib/library.exp
@@ -378,37 +378,6 @@ proc assert_complete_dir {expected cmd dir {test ""} {args {}}} {
-# Make sure a partial argument is completed.
-# A completion is tried with `$partial', or if this is empty, the first
-# character of the first item of `$expected'. Only the items from $expected,
-# starting with this character are then expected as completions.
-# @param list $expected List of all completions.
-# @param string $cmd Command given to generate items
-# @param string $partial Word to complete
-# @param string $test Test title
-# @param list $args See: assert_complete()
-proc assert_complete_partial {expected cmd {partial ""} {test ""} {args {}}} {
- if {$test == ""} {set test "$cmd should complete partial argument"}
- if {[llength $expected] == 0} {
- unresolved "$test"
- } else {
- set pick {}
- # Make sure expected items are unique
- set expected [lsort -unique $expected]
- foreach item $expected {
- if {$partial == ""} {set partial [string range $item 0 0]}
- # Only append item if starting with $partial
- if {[string range $item 0 [expr [string length $partial] - 1]] == "$partial"} {
- lappend pick $item
- }
- }
- # NOTE: The `eval' is necessary to flatten the $args list
- # See also: http://wiki.tcl.tk/11787 - {expand}
- eval assert_complete \$pick \"\$cmd \$partial\" \$test $args; #"
- }
-}
-
-
# If cword contains colon (:), left-trim completions with cword
# @param string $cmd Command to complete
# @param list $items Reference to list of completions to trim
@@ -781,7 +750,6 @@ proc _save_env {{file ""}} {
# Source bash_completion package
proc source_bash_completion {} {
- assert_bash_exec {BASH_COMPLETION_COMPAT_DIR="$SRCDIR/fixtures/shared/empty_dir"}
assert_bash_exec {source $(cd "$SRCDIR/.."; pwd)/bash_completion}
}
diff --git a/test/requirements.txt b/test/requirements.txt
index 23ced801..70d77d02 100644
--- a/test/requirements.txt
+++ b/test/requirements.txt
@@ -1,5 +1,5 @@
-black>=19.3b0
+black>=19.10b0;python_version>"3.6"
pexpect>=4
-pytest>=3.5
+pytest>=3.6
pytest-xdist
typing;python_version<"3.5"
diff --git a/test/runLint b/test/runLint
index 8699d7a0..a84c46d8 100755
--- a/test/runLint
+++ b/test/runLint
@@ -32,7 +32,7 @@ gitgrep $cmdstart'sed\b.*\\\|' \
#gitgrep $cmdstart'sed\b.*;' \
# 'sed with ;, use multiple -e options instead (POSIX?) (false positives?)'
-gitgrep $cmdstart'sed\b.*-[^[:space:]]*[rE]' \
+gitgrep $cmdstart'sed\b.*[[:space:]]-[^[:space:]]*[rE]' \
'sed with -r or -E, drop and use POSIX BRE instead'
gitgrep $cmdstart'[ef]grep\b' \
diff --git a/test/setup.cfg b/test/setup.cfg
new file mode 100644
index 00000000..ef9c755e
--- /dev/null
+++ b/test/setup.cfg
@@ -0,0 +1,9 @@
+[tool:pytest]
+minversion = 3.6
+markers =
+ bashcomp
+ complete
+
+[mypy]
+python_version = 3.4
+ignore_missing_imports = true
diff --git a/test/t/Makefile.am b/test/t/Makefile.am
index fb7665f1..0ce46b12 100644
--- a/test/t/Makefile.am
+++ b/test/t/Makefile.am
@@ -34,6 +34,7 @@ EXTRA_DIST = \
test_autoreconf.py \
test_autorpm.py \
test_autoscan.py \
+ test_autossh.py \
test_autoupdate.py \
test_avctrl.py \
test_awk.py \
@@ -53,6 +54,7 @@ EXTRA_DIST = \
test_cal.py \
test_cancel.py \
test_cardctl.py \
+ test_carton.py \
test_cat.py \
test_cc.py \
test_ccache.py \
@@ -86,7 +88,9 @@ EXTRA_DIST = \
test_clisp.py \
test_clone_member.py \
test_co.py \
+ test_colordiff.py \
test_compare.py \
+ test_compgen.py \
test_complete.py \
test_composite.py \
test_config_list.py \
@@ -122,6 +126,7 @@ EXTRA_DIST = \
test_dir.py \
test_display.py \
test_dmesg.py \
+ test_dmypy.py \
test_dnssec_keygen.py \
test_dnsspoof.py \
test_dot.py \
@@ -207,6 +212,7 @@ EXTRA_DIST = \
test_growisofs.py \
test_grpck.py \
test_grub.py \
+ test_gssdp_discover.py \
test_gzip.py \
test_hciattach.py \
test_hciconfig.py \
@@ -232,6 +238,7 @@ EXTRA_DIST = \
test_iftop.py \
test_ifup.py \
test_import.py \
+ test_influx.py \
test_info.py \
test_inject.py \
test_inotifywait.py \
@@ -560,6 +567,7 @@ EXTRA_DIST = \
test_strip.py \
test_su.py \
test_sudo.py \
+ test_sum.py \
test_svcadm.py \
test_svk.py \
test_svn.py \
@@ -658,6 +666,7 @@ EXTRA_DIST = \
test_xrandr.py \
test_xrdb.py \
test_xsltproc.py \
+ test_xvfb_run.py \
test_xvnc4viewer.py \
test_xxd.py \
test_xz.py \
@@ -671,7 +680,7 @@ EXTRA_DIST = \
all:
-PYTEST = pytest
+PYTEST = @PYTEST@
check-local:
$(PYTEST) $(PYTESTFLAGS) $(srcdir)
diff --git a/test/t/conftest.py b/test/t/conftest.py
index 0969a313..20942e87 100644
--- a/test/t/conftest.py
+++ b/test/t/conftest.py
@@ -2,6 +2,7 @@ import difflib
import os
import re
import shlex
+import subprocess
from typing import Iterable, List, Optional, Tuple, Union
import pexpect
@@ -81,7 +82,7 @@ def bash(request) -> pexpect.spawn:
logfile = None
if os.environ.get("BASHCOMP_TEST_LOGFILE"):
- logfile = open(os.environ.get("BASHCOMP_TEST_LOGFILE"), "w")
+ logfile = open(os.environ["BASHCOMP_TEST_LOGFILE"], "w")
testdir = os.path.abspath(
os.path.join(os.path.dirname(__file__), os.pardir)
)
@@ -93,8 +94,6 @@ def bash(request) -> pexpect.spawn:
PS1=PS1,
INPUTRC="%s/config/inputrc" % testdir,
TERM="dumb",
- BASH_COMPLETION_COMPAT_DIR="%s/fixtures/shared/empty_dir"
- % testdir,
LC_COLLATE="C", # to match Python's default locale unaware sort
)
)
@@ -123,7 +122,7 @@ def bash(request) -> pexpect.spawn:
assert_bash_exec(bash, "source '%s/../bash_completion'" % testdir)
# Use command name from marker if set, or grab from test filename
- cmd = None
+ cmd = None # type: Optional[str]
cmd_found = False
marker = request.node.get_closest_marker("bashcomp")
if marker:
@@ -132,7 +131,7 @@ def bash(request) -> pexpect.spawn:
# Run pre-test commands, early so they're usable in skipif
for pre_cmd in marker.kwargs.get("pre_cmds", []):
assert_bash_exec(bash, pre_cmd)
- # Process skip conditions
+ # Process skip and xfail conditions
skipif = marker.kwargs.get("skipif")
if skipif:
try:
@@ -142,7 +141,14 @@ def bash(request) -> pexpect.spawn:
else:
bash.close()
pytest.skip(skipif)
- return
+ xfail = marker.kwargs.get("xfail")
+ if xfail:
+ try:
+ assert_bash_exec(bash, xfail)
+ except AssertionError:
+ pass
+ else:
+ pytest.xfail(xfail)
if not cmd_found:
match = re.search(
r"^test_(.+)\.py$", os.path.basename(str(request.fspath))
@@ -150,6 +156,8 @@ def bash(request) -> pexpect.spawn:
if match:
cmd = match.group(1)
+ request.cls.cmd = cmd
+
if (cmd_found and cmd is None) or is_testable(bash, cmd):
before_env = get_env(bash)
yield bash
@@ -178,16 +186,14 @@ def is_testable(bash: pexpect.spawn, cmd: str) -> bool:
if not cmd:
pytest.fail("Could not resolve name of command to test")
return False
- if not is_bash_type(bash, cmd):
- pytest.skip("Command %s not found" % cmd)
- return False
if not load_completion_for(bash, cmd):
pytest.skip("No completion for command %s" % cmd)
- return False
return True
-def is_bash_type(bash: pexpect.spawn, cmd: str) -> bool:
+def is_bash_type(bash: pexpect.spawn, cmd: Optional[str]) -> bool:
+ if not cmd:
+ return False
typecmd = "type %s &>/dev/null && echo -n 0 || echo -n 1" % cmd
bash.sendline(typecmd)
bash.expect_exact(typecmd + "\r\n")
@@ -208,7 +214,7 @@ def load_completion_for(bash: pexpect.spawn, cmd: str) -> bool:
def assert_bash_exec(
- bash: pexpect.spawn, cmd: str, want_output: bool = False
+ bash: pexpect.spawn, cmd: str, want_output: bool = False, want_newline=True
) -> str:
# Send command
@@ -216,7 +222,7 @@ def assert_bash_exec(
bash.expect_exact(cmd)
# Find prompt, output is before it
- bash.expect_exact("\r\n" + PS1)
+ bash.expect_exact("%s%s" % ("\r\n" if want_newline else "", PS1))
output = bash.before
# Retrieve exit status
@@ -318,7 +324,7 @@ class CompletionResult:
Defining __eq__ this way is quite ugly, but facilitates concise
testing code.
"""
- expiter = [expected] if isinstance(expected, str) else sorted(expected)
+ expiter = [expected] if isinstance(expected, str) else expected
if self._items is not None:
return self._items == expiter
return bool(
@@ -370,7 +376,14 @@ def assert_complete(
pass
else:
pytest.skip(skipif)
- return CompletionResult("", [])
+ xfail = kwargs.get("xfail")
+ if xfail:
+ try:
+ assert_bash_exec(bash, xfail)
+ except AssertionError:
+ pass
+ else:
+ pytest.xfail(xfail)
cwd = kwargs.get("cwd")
if cwd:
assert_bash_exec(bash, "cd '%s'" % cwd)
@@ -441,11 +454,45 @@ def completion(request, bash: pexpect.spawn) -> CompletionResult:
return CompletionResult("", [])
for pre_cmd in marker.kwargs.get("pre_cmds", []):
assert_bash_exec(bash, pre_cmd)
+ cmd = getattr(request.cls, "cmd", None)
+ if marker.kwargs.get("require_longopt"):
+ # longopt completions require both command presence and that it
+ # responds something useful to --help
+ if "require_cmd" not in marker.kwargs:
+ marker.kwargs["require_cmd"] = True
+ if "xfail" not in marker.kwargs:
+ marker.kwargs["xfail"] = (
+ "! %s --help &>/dev/null || "
+ "! %s --help 2>&1 | command grep -qF -- --help"
+ ) % ((cmd,) * 2)
+ if marker.kwargs.get("require_cmd") and not is_bash_type(bash, cmd):
+ pytest.skip("Command not found")
return assert_complete(bash, marker.args[0], **marker.kwargs)
-def in_docker() -> bool:
- return os.path.exists("/.dockerenv")
+def in_container() -> bool:
+ try:
+ container = subprocess.check_output(
+ "virt-what || systemd-detect-virt --container",
+ stderr=subprocess.DEVNULL,
+ shell=True,
+ ).strip()
+ except subprocess.CalledProcessError:
+ container = b""
+ if container and container != b"none":
+ return True
+ if os.path.exists("/.dockerenv"):
+ return True
+ try:
+ with open("/proc/1/environ", "rb") as f:
+ # LXC, others?
+ if any(
+ x.startswith(b"container=") for x in f.readline().split(b"\0")
+ ):
+ return True
+ except OSError:
+ pass
+ return False
class TestUnitBase:
diff --git a/test/t/test_2to3.py b/test/t/test_2to3.py
index 966ed1f5..030fb261 100644
--- a/test/t/test_2to3.py
+++ b/test/t/test_2to3.py
@@ -5,3 +5,7 @@ class Test2to3:
@pytest.mark.complete("2to3 ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("2to3 -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_7z.py b/test/t/test_7z.py
index 7d68c7b2..c6e73890 100644
--- a/test/t/test_7z.py
+++ b/test/t/test_7z.py
@@ -20,7 +20,7 @@ class Test7z:
def test_4(self, completion):
assert completion == "a.7z"
- @pytest.mark.complete("7z d a.7z ", cwd="7z")
+ @pytest.mark.complete("7z d a.7z ", cwd="7z", require_cmd=True)
def test_5(self, completion):
assert completion == "abc"
diff --git a/test/t/test_a2ps.py b/test/t/test_a2ps.py
index 9d885461..38365f03 100644
--- a/test/t/test_a2ps.py
+++ b/test/t/test_a2ps.py
@@ -5,3 +5,7 @@ class TestA2ps:
@pytest.mark.complete("a2ps ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("a2ps -", require_cmd=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_a2x.py b/test/t/test_a2x.py
index 3741e28d..4bfb4283 100644
--- a/test/t/test_a2x.py
+++ b/test/t/test_a2x.py
@@ -5,3 +5,7 @@ class TestA2x:
@pytest.mark.complete("a2x ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("a2x -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_abook.py b/test/t/test_abook.py
index 1df910cf..9542a4c9 100644
--- a/test/t/test_abook.py
+++ b/test/t/test_abook.py
@@ -2,6 +2,6 @@ import pytest
class TestAbook:
- @pytest.mark.complete("abook -")
+ @pytest.mark.complete("abook -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_aclocal.py b/test/t/test_aclocal.py
index cb3aca1b..ad28b42b 100644
--- a/test/t/test_aclocal.py
+++ b/test/t/test_aclocal.py
@@ -5,3 +5,7 @@ class TestAclocal:
@pytest.mark.complete("aclocal ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("aclocal -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_acpi.py b/test/t/test_acpi.py
index 8da4eaf4..bd06d938 100644
--- a/test/t/test_acpi.py
+++ b/test/t/test_acpi.py
@@ -2,6 +2,6 @@ import pytest
class TestAcpi:
- @pytest.mark.complete("acpi -")
+ @pytest.mark.complete("acpi -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_acroread.py b/test/t/test_acroread.py
index 471b93c2..22d60240 100644
--- a/test/t/test_acroread.py
+++ b/test/t/test_acroread.py
@@ -2,6 +2,6 @@ import pytest
class TestAcroread:
- @pytest.mark.complete("acroread ", cwd="fixtures/acroread")
+ @pytest.mark.complete("acroread ", cwd="acroread")
def test_1(self, completion):
assert completion == "foo.d/ t.pdf".split()
diff --git a/test/t/test_adb.py b/test/t/test_adb.py
index 081a1047..74b0d372 100644
--- a/test/t/test_adb.py
+++ b/test/t/test_adb.py
@@ -5,3 +5,7 @@ class TestAdb:
@pytest.mark.complete("adb ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("adb -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_alpine.py b/test/t/test_alpine.py
index a8a83a0b..dcc05d30 100644
--- a/test/t/test_alpine.py
+++ b/test/t/test_alpine.py
@@ -2,6 +2,6 @@ import pytest
class TestAlpine:
- @pytest.mark.complete("alpine -")
+ @pytest.mark.complete("alpine -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_ant.py b/test/t/test_ant.py
index e18b6eb4..b14beb94 100644
--- a/test/t/test_ant.py
+++ b/test/t/test_ant.py
@@ -3,7 +3,7 @@ import pytest
@pytest.mark.bashcomp(ignore_env=r"^\+ANT_ARGS=")
class TestAnt:
- @pytest.mark.complete("ant -")
+ @pytest.mark.complete("ant -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_appdata_validate.py b/test/t/test_appdata_validate.py
index d57aa992..8166cf8b 100644
--- a/test/t/test_appdata_validate.py
+++ b/test/t/test_appdata_validate.py
@@ -6,3 +6,7 @@ class TestAppdataValidate:
@pytest.mark.complete("appdata-validate ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("appdata-validate -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_apt_cache.py b/test/t/test_apt_cache.py
index 0cb50ef6..a1c29cda 100644
--- a/test/t/test_apt_cache.py
+++ b/test/t/test_apt_cache.py
@@ -7,7 +7,7 @@ class TestAptCache:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("apt-cache showsrc [")
+ @pytest.mark.complete("apt-cache showsrc [", require_cmd=True)
def test_2(self, completion):
# Doesn't actually fail on grep errors, but takes a long time.
assert not completion
diff --git a/test/t/test_arch.py b/test/t/test_arch.py
index 69e0b1ae..7a0f4478 100644
--- a/test/t/test_arch.py
+++ b/test/t/test_arch.py
@@ -3,6 +3,6 @@ import pytest
@pytest.mark.bashcomp(pre_cmds=("PATH=/usr/lib/mailman/bin:$PATH",))
class TestArch:
- @pytest.mark.complete("arch -")
+ @pytest.mark.complete("arch -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_arp.py b/test/t/test_arp.py
index 35963d75..cd038bdb 100644
--- a/test/t/test_arp.py
+++ b/test/t/test_arp.py
@@ -1,14 +1,13 @@
import pytest
-from conftest import in_docker
-
class TestArp:
- @pytest.mark.xfail(in_docker(), reason="Probably fails in docker")
- @pytest.mark.complete("arp ")
+ @pytest.mark.complete(
+ "arp ", require_cmd=True, skipif='test -z "$(arp 2>/dev/null)"'
+ )
def test_1(self, completion):
assert completion
- @pytest.mark.complete("arp -")
+ @pytest.mark.complete("arp -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_arping.py b/test/t/test_arping.py
index 850344be..0eef5c9e 100644
--- a/test/t/test_arping.py
+++ b/test/t/test_arping.py
@@ -6,6 +6,6 @@ class TestArping:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("arping -")
+ @pytest.mark.complete("arping -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_arpspoof.py b/test/t/test_arpspoof.py
index 9fcf20b7..c8955f8d 100644
--- a/test/t/test_arpspoof.py
+++ b/test/t/test_arpspoof.py
@@ -2,6 +2,6 @@ import pytest
class TestArpspoof:
- @pytest.mark.complete("arpspoof -")
+ @pytest.mark.complete("arpspoof -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_asciidoc.py b/test/t/test_asciidoc.py
index b295a27d..b748dcd1 100644
--- a/test/t/test_asciidoc.py
+++ b/test/t/test_asciidoc.py
@@ -5,3 +5,7 @@ class TestAsciidoc:
@pytest.mark.complete("asciidoc ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("asciidoc -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_automake.py b/test/t/test_automake.py
index 5d25c6a7..2174e024 100644
--- a/test/t/test_automake.py
+++ b/test/t/test_automake.py
@@ -5,3 +5,7 @@ class TestAutomake:
@pytest.mark.complete("automake ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("automake -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_autoscan.py b/test/t/test_autoscan.py
index b2667543..d3d45a15 100644
--- a/test/t/test_autoscan.py
+++ b/test/t/test_autoscan.py
@@ -5,3 +5,7 @@ class TestAutoscan:
@pytest.mark.complete("autoscan ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("autoscan -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_autossh.py b/test/t/test_autossh.py
new file mode 100644
index 00000000..86407128
--- /dev/null
+++ b/test/t/test_autossh.py
@@ -0,0 +1,7 @@
+import pytest
+
+
+class TestAutossh:
+ @pytest.mark.complete("autossh -", require_cmd=True)
+ def test_1(self, completion):
+ assert completion
diff --git a/test/t/test_awk.py b/test/t/test_awk.py
index ad2034d1..9fd73804 100644
--- a/test/t/test_awk.py
+++ b/test/t/test_awk.py
@@ -5,3 +5,7 @@ class TestAwk:
@pytest.mark.complete("awk ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("awk -", require_longopt=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_badblocks.py b/test/t/test_badblocks.py
index 57a559de..58130b32 100644
--- a/test/t/test_badblocks.py
+++ b/test/t/test_badblocks.py
@@ -5,3 +5,8 @@ class TestBadblocks:
@pytest.mark.complete("badblocks ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("badblocks -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
+ assert all(x not in completion for x in "-w -X".split())
diff --git a/test/t/test_base64.py b/test/t/test_base64.py
index efc35ebb..957f5a37 100644
--- a/test/t/test_base64.py
+++ b/test/t/test_base64.py
@@ -5,3 +5,7 @@ class TestBase64:
@pytest.mark.complete("base64 ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("base64 -", require_longopt=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_bash.py b/test/t/test_bash.py
index d6e6959a..97a3b8d6 100644
--- a/test/t/test_bash.py
+++ b/test/t/test_bash.py
@@ -2,6 +2,6 @@ import pytest
class TestBash:
- @pytest.mark.complete("bash --")
+ @pytest.mark.complete("bash --", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_bc.py b/test/t/test_bc.py
index effcbaea..7f8056e5 100644
--- a/test/t/test_bc.py
+++ b/test/t/test_bc.py
@@ -2,6 +2,6 @@ import pytest
class TestBc:
- @pytest.mark.complete("bc --")
+ @pytest.mark.complete("bc --", require_longopt=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_bind.py b/test/t/test_bind.py
index f97a246e..97a50444 100644
--- a/test/t/test_bind.py
+++ b/test/t/test_bind.py
@@ -2,7 +2,7 @@ import pytest
class TestBind:
- @pytest.mark.complete("bind -")
+ @pytest.mark.complete("bind -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_bison.py b/test/t/test_bison.py
index 47c4908c..a4a481a7 100644
--- a/test/t/test_bison.py
+++ b/test/t/test_bison.py
@@ -2,6 +2,6 @@ import pytest
class TestBison:
- @pytest.mark.complete("bison --")
+ @pytest.mark.complete("bison --", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_bzip2.py b/test/t/test_bzip2.py
index d1cad249..3b501ea4 100644
--- a/test/t/test_bzip2.py
+++ b/test/t/test_bzip2.py
@@ -9,3 +9,7 @@ class TestBzip2:
@pytest.mark.complete("bzip2 ~")
def test_2(self, completion):
assert completion
+
+ @pytest.mark.complete("bzip2 -")
+ def test_3(self, completion):
+ assert completion
diff --git a/test/t/test_cal.py b/test/t/test_cal.py
index 27102c7a..83d17fff 100644
--- a/test/t/test_cal.py
+++ b/test/t/test_cal.py
@@ -5,3 +5,7 @@ class TestCal:
@pytest.mark.complete("cal ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("cal -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_carton.py b/test/t/test_carton.py
new file mode 100644
index 00000000..1c2e4531
--- /dev/null
+++ b/test/t/test_carton.py
@@ -0,0 +1,11 @@
+import pytest
+
+
+class TestCarton:
+ @pytest.mark.complete("carton ", require_cmd=True)
+ def test_commands(self, completion):
+ assert all(x in completion for x in "help install".split())
+
+ @pytest.mark.complete("carton install -", require_cmd=True)
+ def test_install_options(self, completion):
+ assert all(x in completion for x in "--cached --help".split())
diff --git a/test/t/test_cat.py b/test/t/test_cat.py
index 94245e8f..5fa4c8ff 100644
--- a/test/t/test_cat.py
+++ b/test/t/test_cat.py
@@ -5,3 +5,7 @@ class TestCat:
@pytest.mark.complete("cat ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("cat -", require_longopt=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_ccache.py b/test/t/test_ccache.py
index 573e3e44..64620ef4 100644
--- a/test/t/test_ccache.py
+++ b/test/t/test_ccache.py
@@ -2,11 +2,11 @@ import pytest
class TestCcache:
- @pytest.mark.complete("ccache -")
+ @pytest.mark.complete("ccache -", require_cmd=True)
def test_1(self, completion):
assert completion
- @pytest.mark.complete("ccache --clea")
+ @pytest.mark.complete("ccache --clea", require_cmd=True)
def test_2(self, completion):
assert all(x in completion for x in "--cleanup --clear".split())
@@ -18,10 +18,10 @@ class TestCcache:
def test_4(self, completion):
assert "stty" in completion
- @pytest.mark.complete("ccache --hel")
+ @pytest.mark.complete("ccache --hel", require_cmd=True)
def test_5(self, completion):
assert "--help" in completion
- @pytest.mark.complete("ccache --zero-stats ls --hel")
+ @pytest.mark.complete("ccache --zero-stats sh +")
def test_6(self, completion):
- assert "--help" in completion
+ assert "+x" in completion
diff --git a/test/t/test_ccze.py b/test/t/test_ccze.py
index c54a1fa1..abf1234f 100644
--- a/test/t/test_ccze.py
+++ b/test/t/test_ccze.py
@@ -2,7 +2,7 @@ import pytest
class TestCcze:
- @pytest.mark.complete("ccze ")
+ @pytest.mark.complete("ccze ", require_cmd=True)
def test_1(self, completion):
assert completion
@@ -14,6 +14,6 @@ class TestCcze:
def test_3(self, completion):
assert completion
- @pytest.mark.complete("ccze --plugin=")
+ @pytest.mark.complete("ccze --plugin=", require_cmd=True)
def test_4(self, completion):
assert completion
diff --git a/test/t/test_cfagent.py b/test/t/test_cfagent.py
index f4b477bc..990fc62e 100644
--- a/test/t/test_cfagent.py
+++ b/test/t/test_cfagent.py
@@ -2,6 +2,6 @@ import pytest
class TestCfagent:
- @pytest.mark.complete("cfagent -")
+ @pytest.mark.complete("cfagent -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_chage.py b/test/t/test_chage.py
index 6ef34435..3957ae39 100644
--- a/test/t/test_chage.py
+++ b/test/t/test_chage.py
@@ -5,3 +5,7 @@ class TestChage:
@pytest.mark.complete("chage ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("chage -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_checksec.py b/test/t/test_checksec.py
index 4fce13ff..5a11037d 100644
--- a/test/t/test_checksec.py
+++ b/test/t/test_checksec.py
@@ -2,6 +2,6 @@ import pytest
class TestChecksec:
- @pytest.mark.complete("checksec -")
+ @pytest.mark.complete("checksec -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_chkconfig.py b/test/t/test_chkconfig.py
index c610a5d5..08e9827f 100644
--- a/test/t/test_chkconfig.py
+++ b/test/t/test_chkconfig.py
@@ -9,7 +9,7 @@ class TestChkconfig:
# systemd may not be running e.g. in a docker container, and listing
# services will then fail.
@pytest.mark.complete(
- "chkconfig ", skipif="! systemctl list-units &>/dev/null"
+ "chkconfig ", xfail="! systemctl list-units &>/dev/null"
)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_chmod.py b/test/t/test_chmod.py
index ed59cf13..3838b557 100644
--- a/test/t/test_chmod.py
+++ b/test/t/test_chmod.py
@@ -12,7 +12,7 @@ class TestChmod:
def test_2(self, completion):
assert completion
- @pytest.mark.complete("chmod -")
+ @pytest.mark.complete("chmod -", require_cmd=True)
def test_3(self, completion):
assert completion
diff --git a/test/t/test_chpasswd.py b/test/t/test_chpasswd.py
index ce16a75d..ebb292f3 100644
--- a/test/t/test_chpasswd.py
+++ b/test/t/test_chpasswd.py
@@ -2,6 +2,6 @@ import pytest
class TestChpasswd:
- @pytest.mark.complete("chpasswd -")
+ @pytest.mark.complete("chpasswd -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_chromium_browser.py b/test/t/test_chromium_browser.py
index 75cabdaf..b0b19b29 100644
--- a/test/t/test_chromium_browser.py
+++ b/test/t/test_chromium_browser.py
@@ -7,7 +7,19 @@ class TestChromiumBrowser:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("chromium-browser -")
+ @pytest.mark.complete(
+ "chromium-browser -", xfail="! chromium-browser --help &>/dev/null"
+ )
def test_2(self, completion):
assert completion
assert not completion.endswith(" ")
+
+ @pytest.mark.complete("chromium-browser --proxy-server=")
+ def test_proxy_server_scheme(self, completion):
+ assert completion
+ assert not completion.endswith(" ")
+ assert all(x.endswith("://") for x in completion)
+
+ @pytest.mark.complete("chromium-browser --proxy-server=http://")
+ def test_proxy_server_host(self, completion):
+ assert completion
diff --git a/test/t/test_chronyc.py b/test/t/test_chronyc.py
index fdc91ac5..1fee246b 100644
--- a/test/t/test_chronyc.py
+++ b/test/t/test_chronyc.py
@@ -2,10 +2,10 @@ import pytest
class TestChronyc:
- @pytest.mark.complete("chronyc ")
+ @pytest.mark.complete("chronyc ", require_cmd=True)
def test_1(self, completion):
assert completion
- @pytest.mark.complete("chronyc -")
+ @pytest.mark.complete("chronyc -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_chroot.py b/test/t/test_chroot.py
index 99ca56b0..08ace867 100644
--- a/test/t/test_chroot.py
+++ b/test/t/test_chroot.py
@@ -10,3 +10,7 @@ class TestChroot:
def test_2(self, completion):
"""Should complete dirs only, also when invoked using full path."""
assert completion == ["bar bar.d/", "foo.d/"]
+
+ @pytest.mark.complete("chroot -", require_longopt=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_chrpath.py b/test/t/test_chrpath.py
index 036a1a41..8e94dcb6 100644
--- a/test/t/test_chrpath.py
+++ b/test/t/test_chrpath.py
@@ -6,6 +6,6 @@ class TestChrpath:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("chrpath -")
+ @pytest.mark.complete("chrpath -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_chsh.py b/test/t/test_chsh.py
index 26e3a0a3..fe1c7f69 100644
--- a/test/t/test_chsh.py
+++ b/test/t/test_chsh.py
@@ -9,3 +9,7 @@ class TestChsh:
@pytest.mark.complete("chsh -s ")
def test_2(self, completion):
assert completion
+
+ @pytest.mark.complete("chsh -", require_cmd=True)
+ def test_3(self, completion):
+ assert completion
diff --git a/test/t/test_civclient.py b/test/t/test_civclient.py
index cff70f47..bf0c8d89 100644
--- a/test/t/test_civclient.py
+++ b/test/t/test_civclient.py
@@ -2,6 +2,6 @@ import pytest
class TestCivclient:
- @pytest.mark.complete("civclient -")
+ @pytest.mark.complete("civclient -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_civserver.py b/test/t/test_civserver.py
index b822ddef..0b8e5d51 100644
--- a/test/t/test_civserver.py
+++ b/test/t/test_civserver.py
@@ -2,6 +2,6 @@ import pytest
class TestCivserver:
- @pytest.mark.complete("civserver -")
+ @pytest.mark.complete("civserver -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_cksfv.py b/test/t/test_cksfv.py
index b4df8767..b3656597 100644
--- a/test/t/test_cksfv.py
+++ b/test/t/test_cksfv.py
@@ -2,6 +2,6 @@ import pytest
class TestCksfv:
- @pytest.mark.complete("cksfv -")
+ @pytest.mark.complete("cksfv -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_colordiff.py b/test/t/test_colordiff.py
new file mode 100644
index 00000000..f0e0a291
--- /dev/null
+++ b/test/t/test_colordiff.py
@@ -0,0 +1,11 @@
+import pytest
+
+
+class TestColordiff:
+ @pytest.mark.complete("colordiff ")
+ def test_basic(self, completion):
+ assert completion
+
+ @pytest.mark.complete("colordiff -", require_cmd=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_compgen.py b/test/t/test_compgen.py
new file mode 100644
index 00000000..893abdf8
--- /dev/null
+++ b/test/t/test_compgen.py
@@ -0,0 +1,7 @@
+import pytest
+
+
+class TestCompgen:
+ @pytest.mark.complete(r"compgen -f a\'b/", cwd="compgen")
+ def test_1(self, completion):
+ assert not completion
diff --git a/test/t/test_configure.py b/test/t/test_configure.py
index 17bc9d48..0fc61171 100644
--- a/test/t/test_configure.py
+++ b/test/t/test_configure.py
@@ -8,7 +8,7 @@ import pytest
)
)
class TestConfigure:
- @pytest.mark.complete("configure --")
+ @pytest.mark.complete("configure --", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_convert.py b/test/t/test_convert.py
index 90dfb477..c903ea0d 100644
--- a/test/t/test_convert.py
+++ b/test/t/test_convert.py
@@ -9,3 +9,7 @@ class TestConvert:
@pytest.mark.complete("convert -format ")
def test_2(self, completion):
assert completion
+
+ @pytest.mark.complete("convert -", require_cmd=True)
+ def test_3(self, completion):
+ assert completion
diff --git a/test/t/test_cp.py b/test/t/test_cp.py
index a25998fc..7634df75 100644
--- a/test/t/test_cp.py
+++ b/test/t/test_cp.py
@@ -5,3 +5,7 @@ class TestCp:
@pytest.mark.complete("cp ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("cp -", require_longopt=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_cpan2dist.py b/test/t/test_cpan2dist.py
index 13feae9e..f456c0ce 100644
--- a/test/t/test_cpan2dist.py
+++ b/test/t/test_cpan2dist.py
@@ -2,6 +2,6 @@ import pytest
class TestCpan2dist:
- @pytest.mark.complete("cpan2dist -")
+ @pytest.mark.complete("cpan2dist -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_cpio.py b/test/t/test_cpio.py
index 69bb5702..1b9e37df 100644
--- a/test/t/test_cpio.py
+++ b/test/t/test_cpio.py
@@ -11,6 +11,8 @@ class TestCpio:
@pytest.mark.complete("cpio -R ")
def test_2(self, bash, completion):
users = sorted(
- assert_bash_exec(bash, "compgen -A user", want_output=True).split()
+ assert_bash_exec(bash, "compgen -A user", want_output=True)
+ .strip()
+ .splitlines()
)
- assert completion == users
+ assert list(completion) == users
diff --git a/test/t/test_cppcheck.py b/test/t/test_cppcheck.py
index d5e3af9b..da770786 100644
--- a/test/t/test_cppcheck.py
+++ b/test/t/test_cppcheck.py
@@ -6,7 +6,7 @@ class TestCppcheck:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("cppcheck -")
+ @pytest.mark.complete("cppcheck -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_createdb.py b/test/t/test_createdb.py
index 7e226438..030338a0 100644
--- a/test/t/test_createdb.py
+++ b/test/t/test_createdb.py
@@ -4,6 +4,8 @@ import pytest
class TestCreatedb:
# --help can fail due to missing package dependencies, e.g. on Ubuntu 14
- @pytest.mark.complete("createdb -", skipif="! createdb --help &>/dev/null")
+ @pytest.mark.complete(
+ "createdb -", require_cmd=True, xfail="! createdb --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_createuser.py b/test/t/test_createuser.py
index f25f10f7..ea8d0e38 100644
--- a/test/t/test_createuser.py
+++ b/test/t/test_createuser.py
@@ -5,7 +5,7 @@ class TestCreateuser:
# --help can fail due to missing package dependencies, e.g. on Ubuntu 14
@pytest.mark.complete(
- "createuser -", skipif="! createuser --help &>/dev/null"
+ "createuser -", xfail="! createuser --help &>/dev/null"
)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_cryptsetup.py b/test/t/test_cryptsetup.py
index 235ac4fc..fdc981b8 100644
--- a/test/t/test_cryptsetup.py
+++ b/test/t/test_cryptsetup.py
@@ -5,3 +5,7 @@ class TestCryptsetup:
@pytest.mark.complete("cryptsetup ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("cryptsetup -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_csplit.py b/test/t/test_csplit.py
index 54eab34c..609c7e55 100644
--- a/test/t/test_csplit.py
+++ b/test/t/test_csplit.py
@@ -5,3 +5,7 @@ class TestCsplit:
@pytest.mark.complete("csplit ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("csplit -", require_cmd=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_curl.py b/test/t/test_curl.py
index 324fba2a..ebccca95 100644
--- a/test/t/test_curl.py
+++ b/test/t/test_curl.py
@@ -2,7 +2,7 @@ import pytest
class TestCurl:
- @pytest.mark.complete("curl --h")
+ @pytest.mark.complete("curl --h", require_cmd=True)
def test_1(self, completion):
assert completion
@@ -17,3 +17,12 @@ class TestCurl:
@pytest.mark.complete("curl --o f")
def test_4(self, completion):
assert not completion
+
+ @pytest.mark.complete("curl --data @", cwd="shared/default/foo.d")
+ def test_data_atfile(self, completion):
+ assert completion == "@foo"
+
+ @pytest.mark.complete("curl --data @foo.", cwd="shared/default")
+ def test_data_atfile_dir(self, completion):
+ assert completion == "@foo.d/"
+ assert not completion.endswith(" ")
diff --git a/test/t/test_cut.py b/test/t/test_cut.py
index 31fa636a..b0faca6a 100644
--- a/test/t/test_cut.py
+++ b/test/t/test_cut.py
@@ -5,3 +5,7 @@ class TestCut:
@pytest.mark.complete("cut ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("cut -", require_longopt=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_cvs.py b/test/t/test_cvs.py
index 825acbf5..ab7fead8 100644
--- a/test/t/test_cvs.py
+++ b/test/t/test_cvs.py
@@ -14,3 +14,7 @@ class TestCvs:
@pytest.mark.complete("cvs diff foo/", cwd="cvs")
def test_3(self, completion):
assert completion == "foo/bar"
+
+ @pytest.mark.complete("cvs -", require_cmd=True)
+ def test_4(self, completion):
+ assert completion
diff --git a/test/t/test_cvsps.py b/test/t/test_cvsps.py
index 0a4da9ba..4039893c 100644
--- a/test/t/test_cvsps.py
+++ b/test/t/test_cvsps.py
@@ -3,7 +3,7 @@ import pytest
@pytest.mark.bashcomp(pre_cmds=("HOME=$PWD/cvs",))
class TestCvsps:
- @pytest.mark.complete("cvsps -")
+ @pytest.mark.complete("cvsps -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_date.py b/test/t/test_date.py
index 8df574e9..57d61b81 100644
--- a/test/t/test_date.py
+++ b/test/t/test_date.py
@@ -5,3 +5,7 @@ class TestDate:
@pytest.mark.complete("date ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("date -", require_cmd=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_dcop.py b/test/t/test_dcop.py
index 669725e2..5c3c04d0 100644
--- a/test/t/test_dcop.py
+++ b/test/t/test_dcop.py
@@ -1,14 +1,7 @@
-import subprocess
-
import pytest
class TestDcop:
- @pytest.mark.complete("dcop ")
+ @pytest.mark.complete("dcop ", require_cmd=True)
def test_1(self, completion):
- try:
- subprocess.check_call("dcop &>/dev/null", shell=True)
- except BaseException:
- assert not completion
- else:
- assert completion
+ assert completion
diff --git a/test/t/test_dd.py b/test/t/test_dd.py
index 616f4d4a..be1829d3 100644
--- a/test/t/test_dd.py
+++ b/test/t/test_dd.py
@@ -2,7 +2,13 @@ import pytest
class TestDd:
- @pytest.mark.complete("dd --")
+ @pytest.mark.complete(
+ "dd --",
+ xfail=(
+ "! dd --help &>/dev/null || "
+ "! dd --help 2>&1 | command grep -qF -- --help"
+ ),
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_declare.py b/test/t/test_declare.py
index b17affc2..a61d9260 100644
--- a/test/t/test_declare.py
+++ b/test/t/test_declare.py
@@ -2,11 +2,11 @@ import pytest
class TestDeclare:
- @pytest.mark.complete("declare -")
+ @pytest.mark.complete("declare -", require_cmd=True)
def test_1(self, completion):
assert completion
- @pytest.mark.complete("declare +")
+ @pytest.mark.complete("declare +", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_deja_dup.py b/test/t/test_deja_dup.py
index 1da29e99..56e59f9c 100644
--- a/test/t/test_deja_dup.py
+++ b/test/t/test_deja_dup.py
@@ -3,7 +3,7 @@ import pytest
@pytest.mark.bashcomp(cmd="deja-dup")
class TestDejaDup:
- @pytest.mark.complete("deja-dup -")
+ @pytest.mark.complete("deja-dup -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_desktop_file_validate.py b/test/t/test_desktop_file_validate.py
index e007a956..ed4b55b8 100644
--- a/test/t/test_desktop_file_validate.py
+++ b/test/t/test_desktop_file_validate.py
@@ -6,3 +6,7 @@ class TestDesktopFileValidate:
@pytest.mark.complete("desktop-file-validate ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("desktop-file-validate -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_df.py b/test/t/test_df.py
index 247311cc..be28e6cb 100644
--- a/test/t/test_df.py
+++ b/test/t/test_df.py
@@ -5,3 +5,7 @@ class TestDf:
@pytest.mark.complete("df ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("df -", require_longopt=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_dhclient.py b/test/t/test_dhclient.py
index fdfbd473..c6a1af41 100644
--- a/test/t/test_dhclient.py
+++ b/test/t/test_dhclient.py
@@ -2,6 +2,6 @@ import pytest
class TestDhclient:
- @pytest.mark.complete("dhclient -")
+ @pytest.mark.complete("dhclient -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_dict.py b/test/t/test_dict.py
index 65f6b129..99c4a210 100644
--- a/test/t/test_dict.py
+++ b/test/t/test_dict.py
@@ -2,6 +2,6 @@ import pytest
class TestDict:
- @pytest.mark.complete("dict -")
+ @pytest.mark.complete("dict -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_diff.py b/test/t/test_diff.py
index 25157bd9..eb81506b 100644
--- a/test/t/test_diff.py
+++ b/test/t/test_diff.py
@@ -2,6 +2,6 @@ import pytest
class TestDiff:
- @pytest.mark.complete("diff --")
+ @pytest.mark.complete("diff --", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_dir.py b/test/t/test_dir.py
index 3026d502..f8568fb5 100644
--- a/test/t/test_dir.py
+++ b/test/t/test_dir.py
@@ -5,3 +5,7 @@ class TestDir:
@pytest.mark.complete("dir ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("dir -", require_cmd=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_display.py b/test/t/test_display.py
index 9f5c1004..4f076b81 100644
--- a/test/t/test_display.py
+++ b/test/t/test_display.py
@@ -6,6 +6,6 @@ class TestDisplay:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("display -")
+ @pytest.mark.complete("display -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_dmesg.py b/test/t/test_dmesg.py
index 4416fe1c..a081fb67 100644
--- a/test/t/test_dmesg.py
+++ b/test/t/test_dmesg.py
@@ -2,6 +2,6 @@ import pytest
class TestDmesg:
- @pytest.mark.complete("dmesg -")
+ @pytest.mark.complete("dmesg -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_dmypy.py b/test/t/test_dmypy.py
new file mode 100644
index 00000000..efaef7ca
--- /dev/null
+++ b/test/t/test_dmypy.py
@@ -0,0 +1,12 @@
+import pytest
+
+
+class TestDmypy:
+ @pytest.mark.complete("dmypy ", require_cmd=True)
+ def test_commands(self, completion):
+ assert "help" in completion
+ assert not any("," in x for x in completion)
+
+ @pytest.mark.complete("dmypy -", require_cmd=True)
+ def test_options(self, completion):
+ assert "--help" in completion
diff --git a/test/t/test_dnsspoof.py b/test/t/test_dnsspoof.py
index fae6c430..b3380d14 100644
--- a/test/t/test_dnsspoof.py
+++ b/test/t/test_dnsspoof.py
@@ -2,6 +2,6 @@ import pytest
class TestDnsspoof:
- @pytest.mark.complete("dnsspoof -")
+ @pytest.mark.complete("dnsspoof -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_dpkg.py b/test/t/test_dpkg.py
index e609ee86..eb1228b7 100644
--- a/test/t/test_dpkg.py
+++ b/test/t/test_dpkg.py
@@ -2,13 +2,11 @@ import pytest
class TestDpkg:
- @pytest.mark.complete("dpkg --c")
+ @pytest.mark.complete("dpkg --c", require_cmd=True)
def test_1(self, completion):
assert completion
- @pytest.mark.complete(
- "dpkg -L ", skipif='test -z "$(dpkg -l 2>/dev/null)"'
- )
+ @pytest.mark.complete("dpkg -L ", xfail='test -z "$(dpkg -l 2>/dev/null)"')
def test_2(self, completion):
assert completion
diff --git a/test/t/test_dpkg_deb.py b/test/t/test_dpkg_deb.py
index 4bd7368b..c1ad8191 100644
--- a/test/t/test_dpkg_deb.py
+++ b/test/t/test_dpkg_deb.py
@@ -3,6 +3,6 @@ import pytest
@pytest.mark.bashcomp(cmd="dpkg-deb")
class TestDpkgDeb:
- @pytest.mark.complete("dpkg-deb --c")
+ @pytest.mark.complete("dpkg-deb --c", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_dropdb.py b/test/t/test_dropdb.py
index 7e0b7929..2f658576 100644
--- a/test/t/test_dropdb.py
+++ b/test/t/test_dropdb.py
@@ -4,6 +4,8 @@ import pytest
class TestDropdb:
# --help can fail due to missing package dependencies, e.g. on Ubuntu 14
- @pytest.mark.complete("dropdb -", skipif="! dropdb --help &>/dev/null")
+ @pytest.mark.complete(
+ "dropdb -", require_cmd=True, xfail="! dropdb --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_dselect.py b/test/t/test_dselect.py
index 3145cc40..8e9d24ef 100644
--- a/test/t/test_dselect.py
+++ b/test/t/test_dselect.py
@@ -6,6 +6,6 @@ class TestDselect:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("dselect -")
+ @pytest.mark.complete("dselect -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_du.py b/test/t/test_du.py
index c014b069..3d73e99a 100644
--- a/test/t/test_du.py
+++ b/test/t/test_du.py
@@ -5,3 +5,7 @@ class TestDu:
@pytest.mark.complete("du ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("du -", require_longopt=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_dumpe2fs.py b/test/t/test_dumpe2fs.py
index fa7590e6..eacb1fe1 100644
--- a/test/t/test_dumpe2fs.py
+++ b/test/t/test_dumpe2fs.py
@@ -5,3 +5,7 @@ class TestDumpe2fs:
@pytest.mark.complete("dumpe2fs ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("dumpe2fs -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_e2freefrag.py b/test/t/test_e2freefrag.py
index 6685382d..10eb41de 100644
--- a/test/t/test_e2freefrag.py
+++ b/test/t/test_e2freefrag.py
@@ -5,3 +5,7 @@ class TestE2freefrag:
@pytest.mark.complete("e2freefrag ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("e2freefrag -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_ecryptfs_migrate_home.py b/test/t/test_ecryptfs_migrate_home.py
index fd49ca8b..f2115d27 100644
--- a/test/t/test_ecryptfs_migrate_home.py
+++ b/test/t/test_ecryptfs_migrate_home.py
@@ -3,6 +3,10 @@ import pytest
@pytest.mark.bashcomp(cmd="ecryptfs-migrate-home")
class TestEcryptfsMigrateHome:
- @pytest.mark.complete("ecryptfs-migrate-home ")
+ @pytest.mark.complete("ecryptfs-migrate-home ", require_cmd=True)
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("ecryptfs-migrate-home -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_eject.py b/test/t/test_eject.py
index 037ea98e..d4ec1bd1 100644
--- a/test/t/test_eject.py
+++ b/test/t/test_eject.py
@@ -2,6 +2,6 @@ import pytest
class TestEject:
- @pytest.mark.complete("eject -")
+ @pytest.mark.complete("eject -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_enscript.py b/test/t/test_enscript.py
index 2e4ff51a..97120e3e 100644
--- a/test/t/test_enscript.py
+++ b/test/t/test_enscript.py
@@ -2,6 +2,6 @@ import pytest
class TestEnscript:
- @pytest.mark.complete("enscript --")
+ @pytest.mark.complete("enscript --", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_env.py b/test/t/test_env.py
index 57ed9769..3d1a684e 100644
--- a/test/t/test_env.py
+++ b/test/t/test_env.py
@@ -2,6 +2,6 @@ import pytest
class TestEnv:
- @pytest.mark.complete("env --", skipif="! env --help &>/dev/null")
+ @pytest.mark.complete("env --", require_longopt=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_eog.py b/test/t/test_eog.py
index c095934f..5ae21d91 100644
--- a/test/t/test_eog.py
+++ b/test/t/test_eog.py
@@ -5,3 +5,7 @@ class TestEog:
@pytest.mark.complete("eog ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("eog -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_ether_wake.py b/test/t/test_ether_wake.py
index b9dac0b4..7afe2862 100644
--- a/test/t/test_ether_wake.py
+++ b/test/t/test_ether_wake.py
@@ -1,8 +1,18 @@
+import os
+
import pytest
@pytest.mark.bashcomp(cmd="ether-wake")
class TestEtherWake:
+ @pytest.mark.xfail(
+ os.environ.get("NETWORK") == "none",
+ reason="MAC addresses may be N/A with no networking configured",
+ )
@pytest.mark.complete("ether-wake ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("ether-wake -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_evince.py b/test/t/test_evince.py
index 0dc44f38..9e9245de 100644
--- a/test/t/test_evince.py
+++ b/test/t/test_evince.py
@@ -16,3 +16,7 @@ class TestEvince:
".ps.bz2 .ps.BZ2 .PS.bz2 .PS.BZ2 .ps.gz .ps.GZ .PS.gz .PS.GZ "
".tga .TGA .tif .TIF .tiff .TIFF .xpm .XPM .xwd .XWD".split()
)
+
+ @pytest.mark.complete("evince -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_expand.py b/test/t/test_expand.py
index 004c018b..11f4bdb8 100644
--- a/test/t/test_expand.py
+++ b/test/t/test_expand.py
@@ -2,6 +2,6 @@ import pytest
class TestExpand:
- @pytest.mark.complete("expand --", skipif="! expand --help &>/dev/null")
+ @pytest.mark.complete("expand --", require_longopt=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_explodepkg.py b/test/t/test_explodepkg.py
index 29463dfd..940fec80 100644
--- a/test/t/test_explodepkg.py
+++ b/test/t/test_explodepkg.py
@@ -8,11 +8,16 @@ class TestExplodepkg:
@pytest.mark.complete("explodepkg ", cwd="slackware/home")
def test_1(self, completion):
expected = sorted(
- x
- for x in os.listdir("slackware/home")
- if os.path.isdir("./%s" % x)
- or (
- os.path.isfile("./%s" % x) and fnmatch.fnmatch(x, "*.t[bglx]z")
- )
+ [
+ "%s/" % x
+ for x in os.listdir("slackware/home")
+ if os.path.isdir("./slackware/home/%s" % x)
+ ]
+ + [
+ x
+ for x in os.listdir("slackware/home")
+ if os.path.isfile("./slackware/home/%s" % x)
+ and fnmatch.fnmatch(x, "*.t[bglx]z")
+ ]
)
assert completion == expected
diff --git a/test/t/test_export.py b/test/t/test_export.py
index 59dfdb2e..8738913a 100644
--- a/test/t/test_export.py
+++ b/test/t/test_export.py
@@ -31,6 +31,6 @@ class TestExport:
def test_7(self, completion):
assert completion
- @pytest.mark.complete("export -")
+ @pytest.mark.complete("export -", require_cmd=True)
def test_8(self, completion):
assert completion
diff --git a/test/t/test_faillog.py b/test/t/test_faillog.py
index d9799d57..edf490b5 100644
--- a/test/t/test_faillog.py
+++ b/test/t/test_faillog.py
@@ -2,6 +2,6 @@ import pytest
class TestFaillog:
- @pytest.mark.complete("faillog -")
+ @pytest.mark.complete("faillog -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_feh.py b/test/t/test_feh.py
index 1802e25f..51bd77b6 100644
--- a/test/t/test_feh.py
+++ b/test/t/test_feh.py
@@ -7,7 +7,9 @@ class TestFeh:
assert completion
@pytest.mark.complete(
- "feh --lis", skipif="feh --help 2>&1 | grep -qF 'man feh'"
+ "feh --lis",
+ xfail="feh --help 2>&1 | command grep -qF 'man feh'",
+ require_cmd=True,
)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_file.py b/test/t/test_file.py
index cfd2c100..0c19eb4d 100644
--- a/test/t/test_file.py
+++ b/test/t/test_file.py
@@ -6,6 +6,6 @@ class TestFile:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("file -")
+ @pytest.mark.complete("file -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_filefrag.py b/test/t/test_filefrag.py
index 860b2512..342e89ce 100644
--- a/test/t/test_filefrag.py
+++ b/test/t/test_filefrag.py
@@ -5,3 +5,7 @@ class TestFilefrag:
@pytest.mark.complete("filefrag ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("filefrag -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_filesnarf.py b/test/t/test_filesnarf.py
index cd399d4a..cee621ec 100644
--- a/test/t/test_filesnarf.py
+++ b/test/t/test_filesnarf.py
@@ -2,6 +2,6 @@ import pytest
class TestFilesnarf:
- @pytest.mark.complete("filesnarf -")
+ @pytest.mark.complete("filesnarf -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_finger.py b/test/t/test_finger.py
index e3cdfacd..92c983fa 100644
--- a/test/t/test_finger.py
+++ b/test/t/test_finger.py
@@ -4,11 +4,22 @@ from conftest import assert_bash_exec
class TestFinger:
- @pytest.mark.complete("finger ")
- def test_1(self, bash, completion):
- users_at = sorted(
+ @pytest.fixture(scope="class")
+ def users_at(self, bash):
+ return sorted(
assert_bash_exec(
bash, "compgen -A user -S @", want_output=True
).split()
)
+
+ @pytest.mark.complete("finger ")
+ def test_1(self, bash, completion, users_at):
assert completion == users_at
+
+ @pytest.mark.complete("finger r")
+ def test_2(self, bash, completion, users_at):
+ if not any(x.startswith("r") for x in users_at):
+ pytest.skip("No users starting with r")
+ assert completion
+ assert all(x.startswith("r") for x in completion)
+ assert not completion.endswith(" ")
diff --git a/test/t/test_fio.py b/test/t/test_fio.py
index 8dd6f789..0f6eba74 100644
--- a/test/t/test_fio.py
+++ b/test/t/test_fio.py
@@ -6,7 +6,7 @@ class TestFio:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("fio --")
+ @pytest.mark.complete("fio --", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_firefox.py b/test/t/test_firefox.py
index cbba2c6c..2e052553 100644
--- a/test/t/test_firefox.py
+++ b/test/t/test_firefox.py
@@ -6,7 +6,7 @@ class TestFirefox:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("firefox -")
+ @pytest.mark.complete("firefox -", require_cmd=True)
def test_2(self, completion):
assert completion
assert not completion.endswith(" ")
diff --git a/test/t/test_flake8.py b/test/t/test_flake8.py
index 9922fb85..67649fa7 100644
--- a/test/t/test_flake8.py
+++ b/test/t/test_flake8.py
@@ -1,13 +1,14 @@
import pytest
-@pytest.mark.bashcomp(skipif="! flake8 --help &>/dev/null")
class TestFlake8:
@pytest.mark.complete("flake8 ")
def test_1(self, completion):
assert completion
- @pytest.mark.complete("flake8 -")
+ @pytest.mark.complete(
+ "flake8 -", require_cmd=True, xfail="! flake8 --help &>/dev/null"
+ )
def test_2(self, completion):
assert completion
diff --git a/test/t/test_fmt.py b/test/t/test_fmt.py
index dc3473ba..12706da2 100644
--- a/test/t/test_fmt.py
+++ b/test/t/test_fmt.py
@@ -2,6 +2,8 @@ import pytest
class TestFmt:
- @pytest.mark.complete("fmt -", skipif="! fmt --help &>/dev/null")
+ @pytest.mark.complete(
+ "fmt -", require_cmd=True, xfail="! fmt --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_fold.py b/test/t/test_fold.py
index 9a8fd2aa..1cbaef92 100644
--- a/test/t/test_fold.py
+++ b/test/t/test_fold.py
@@ -2,6 +2,6 @@ import pytest
class TestFold:
- @pytest.mark.complete("fold --", skipif="! fold --help &>/dev/null")
+ @pytest.mark.complete("fold --", require_longopt=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_freeciv.py b/test/t/test_freeciv.py
index 1027e43c..a195eb86 100644
--- a/test/t/test_freeciv.py
+++ b/test/t/test_freeciv.py
@@ -2,6 +2,6 @@ import pytest
class TestFreeciv:
- @pytest.mark.complete("freeciv -")
+ @pytest.mark.complete("freeciv -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_freeciv_server.py b/test/t/test_freeciv_server.py
index 5546a5e9..8543a212 100644
--- a/test/t/test_freeciv_server.py
+++ b/test/t/test_freeciv_server.py
@@ -3,6 +3,6 @@ import pytest
@pytest.mark.bashcomp(cmd="freeciv-server")
class TestFreecivServer:
- @pytest.mark.complete("freeciv-server -")
+ @pytest.mark.complete("freeciv-server -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_fusermount.py b/test/t/test_fusermount.py
index 3781586d..dbb2bd99 100644
--- a/test/t/test_fusermount.py
+++ b/test/t/test_fusermount.py
@@ -5,3 +5,7 @@ class TestFusermount:
@pytest.mark.complete("fusermount ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("fusermount -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_gcc.py b/test/t/test_gcc.py
index 67f4ee57..87f25797 100644
--- a/test/t/test_gcc.py
+++ b/test/t/test_gcc.py
@@ -1,7 +1,67 @@
import pytest
+from conftest import assert_bash_exec
+
class TestGcc:
+ @pytest.fixture(scope="class")
+ def gcc_with_completion(self, bash):
+ got = assert_bash_exec(
+ bash, "gcc --help=common || :", want_output=True
+ )
+ if "--completion" not in got:
+ pytest.skip("GCC does not support --completion")
+
+ @pytest.fixture(scope="class")
+ def gcc_x86(self, bash):
+ got = assert_bash_exec(bash, "gcc -v || :", want_output=True)
+ if "Target: x86" not in got:
+ pytest.skip("Not a x86 GCC")
+
@pytest.mark.complete("gcc ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("gcc -fsanitize=add")
+ def test_enum_value(self, completion, gcc_with_completion):
+ assert completion == "-fsanitize=address"
+
+ @pytest.mark.complete("gcc -fsanitize=")
+ def test_enum_value_with_eq(self, completion, gcc_with_completion):
+ assert "address" in completion
+
+ @pytest.mark.complete("gcc -fno-ipa-ic")
+ def test_negative_option(self, completion, gcc_with_completion):
+ assert "-fno-ipa-icf" in completion
+
+ @pytest.mark.complete("gcc -fxyz-abc")
+ def test_no_completion(self, completion):
+ assert not completion
+
+ @pytest.mark.complete("gcc --param ")
+ def test_param_with_space(self, completion, gcc_with_completion):
+ assert len(completion) > 50
+ # starting with GCC 10.1 param end with =
+ assert (
+ "lto-partitions" in completion or "lto-partitions=" in completion
+ )
+
+ @pytest.mark.complete("gcc --param=lto-max-p")
+ def test_param_with_eq(self, completion, gcc_with_completion):
+ # starting with GCC 10.1 param end with =
+ assert (
+ completion == "--param=lto-max-partition"
+ or completion == "--param=lto-max-partition="
+ )
+
+ @pytest.mark.complete("gcc -march=amd")
+ def test_march(self, completion, gcc_with_completion, gcc_x86):
+ assert completion == "-march=amdfam10"
+
+ @pytest.mark.complete("gcc -march=")
+ def test_march_native(self, completion, gcc_with_completion):
+ assert "native" in completion
+
+ @pytest.mark.complete("gcc -mtune=")
+ def test_mtune_generic(self, completion, gcc_with_completion):
+ assert "generic" in completion
diff --git a/test/t/test_genisoimage.py b/test/t/test_genisoimage.py
index ba16cea2..bfcef3bc 100644
--- a/test/t/test_genisoimage.py
+++ b/test/t/test_genisoimage.py
@@ -5,3 +5,7 @@ class TestGenisoimage:
@pytest.mark.complete("genisoimage ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("genisoimage -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_geoiplookup.py b/test/t/test_geoiplookup.py
index d114d55f..9a1422bc 100644
--- a/test/t/test_geoiplookup.py
+++ b/test/t/test_geoiplookup.py
@@ -2,6 +2,6 @@ import pytest
class TestGeoiplookup:
- @pytest.mark.complete("geoiplookup -")
+ @pytest.mark.complete("geoiplookup -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_getconf.py b/test/t/test_getconf.py
index 6f9192d2..c80c803e 100644
--- a/test/t/test_getconf.py
+++ b/test/t/test_getconf.py
@@ -14,7 +14,9 @@ class TestGetconf:
def test_3(self, completion):
assert completion
- @pytest.mark.complete("getconf -v ")
+ @pytest.mark.complete(
+ "getconf -v ", xfail="! getconf -a 2>&1 | command grep -q ^POSIX_V"
+ )
def test_4(self, completion):
assert completion
diff --git a/test/t/test_getent.py b/test/t/test_getent.py
index fa84880c..a1e9fcbb 100644
--- a/test/t/test_getent.py
+++ b/test/t/test_getent.py
@@ -5,3 +5,14 @@ class TestGetent:
@pytest.mark.complete("getent ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete(
+ "getent -",
+ require_cmd=True,
+ xfail=(
+ "! (getent --help 2>&1 || :) | "
+ "command grep -q -- '[[:space:]]-'"
+ ),
+ )
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_gkrellm.py b/test/t/test_gkrellm.py
index 8ab4b5a7..fdc2e165 100644
--- a/test/t/test_gkrellm.py
+++ b/test/t/test_gkrellm.py
@@ -5,6 +5,6 @@ import pytest
@pytest.mark.xfail(not os.environ.get("DISPLAY"), reason="X display required")
class TestGkrellm:
- @pytest.mark.complete("gkrellm -")
+ @pytest.mark.complete("gkrellm -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_gm.py b/test/t/test_gm.py
index 82d16702..9cdd73c4 100644
--- a/test/t/test_gm.py
+++ b/test/t/test_gm.py
@@ -2,15 +2,15 @@ import pytest
class TestGm:
- @pytest.mark.complete("gm ")
+ @pytest.mark.complete("gm ", require_cmd=True)
def test_1(self, completion):
assert completion
- @pytest.mark.complete("gm help ")
+ @pytest.mark.complete("gm help ", require_cmd=True)
def test_2(self, completion):
assert completion
- @pytest.mark.complete("gm time ")
+ @pytest.mark.complete("gm time ", require_cmd=True)
def test_3(self, completion):
assert completion
diff --git a/test/t/test_gnokii.py b/test/t/test_gnokii.py
index 106005f9..66af6e99 100644
--- a/test/t/test_gnokii.py
+++ b/test/t/test_gnokii.py
@@ -2,6 +2,10 @@ import pytest
class TestGnokii:
- @pytest.mark.complete("gnokii ")
+ @pytest.mark.complete("gnokii ", require_cmd=True)
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("gnokii -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_gnome_mplayer.py b/test/t/test_gnome_mplayer.py
index 5ee952c1..379c56ce 100644
--- a/test/t/test_gnome_mplayer.py
+++ b/test/t/test_gnome_mplayer.py
@@ -1,8 +1,17 @@
import pytest
-@pytest.mark.bashcomp(cmd="gnome-mplayer")
+@pytest.mark.bashcomp(cmd="gnome-mplayer", ignore_env=r"^[+-]XDG_DATA_DIRS=")
class TestGnomeMplayer:
@pytest.mark.complete("gnome-mplayer ")
def test_1(self, completion):
assert completion
+
+ # XDG_DATA_DIRS set to a dir with no schemas results in
+ # "GLib-GIO-ERROR **: No GSettings schemas are installed on the system"
+ # and a core dump on --help on Ubuntu 14.
+ @pytest.mark.complete(
+ "gnome-mplayer -", require_cmd=True, pre_cmds=("unset XDG_DATA_DIRS",)
+ )
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_gnome_screenshot.py b/test/t/test_gnome_screenshot.py
index 476f57f1..977e03fb 100644
--- a/test/t/test_gnome_screenshot.py
+++ b/test/t/test_gnome_screenshot.py
@@ -3,6 +3,6 @@ import pytest
@pytest.mark.bashcomp(cmd="gnome-screenshot")
class TestGnomeScreenshot:
- @pytest.mark.complete("gnome-screenshot --help")
+ @pytest.mark.complete("gnome-screenshot --help", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_gpasswd.py b/test/t/test_gpasswd.py
index 43826a58..4f0221b9 100644
--- a/test/t/test_gpasswd.py
+++ b/test/t/test_gpasswd.py
@@ -5,3 +5,7 @@ class TestGpasswd:
@pytest.mark.complete("gpasswd ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("gpasswd -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_gperf.py b/test/t/test_gperf.py
index f8267bf7..54f75b18 100644
--- a/test/t/test_gperf.py
+++ b/test/t/test_gperf.py
@@ -2,6 +2,6 @@ import pytest
class TestGperf:
- @pytest.mark.complete("gperf --")
+ @pytest.mark.complete("gperf --", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_gpg2.py b/test/t/test_gpg2.py
index 6a7ff333..27a39faf 100644
--- a/test/t/test_gpg2.py
+++ b/test/t/test_gpg2.py
@@ -2,6 +2,6 @@ import pytest
class TestGpg2:
- @pytest.mark.complete("gpg2 --h")
+ @pytest.mark.complete("gpg2 --h", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_gpgv.py b/test/t/test_gpgv.py
index 05feb71f..d600c74f 100644
--- a/test/t/test_gpgv.py
+++ b/test/t/test_gpgv.py
@@ -6,7 +6,7 @@ class TestGpgv:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("gpgv -")
+ @pytest.mark.complete("gpgv -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_gphoto2.py b/test/t/test_gphoto2.py
index 830e6f6f..bb987f7e 100644
--- a/test/t/test_gphoto2.py
+++ b/test/t/test_gphoto2.py
@@ -2,6 +2,6 @@ import pytest
class TestGphoto2:
- @pytest.mark.complete("gphoto2 --")
+ @pytest.mark.complete("gphoto2 --", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_gprof.py b/test/t/test_gprof.py
index 417e0914..a30cc1e7 100644
--- a/test/t/test_gprof.py
+++ b/test/t/test_gprof.py
@@ -2,6 +2,6 @@ import pytest
class TestGprof:
- @pytest.mark.complete("gprof --", skipif="! gprof --help &>/dev/null")
+ @pytest.mark.complete("gprof --", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_grep.py b/test/t/test_grep.py
index d7d742ec..a249122e 100644
--- a/test/t/test_grep.py
+++ b/test/t/test_grep.py
@@ -2,7 +2,7 @@ import pytest
class TestGrep:
- @pytest.mark.complete("grep --")
+ @pytest.mark.complete("grep --", require_longopt=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_groupadd.py b/test/t/test_groupadd.py
index efea4677..f882d1ed 100644
--- a/test/t/test_groupadd.py
+++ b/test/t/test_groupadd.py
@@ -6,6 +6,6 @@ class TestGroupadd:
def test_1(self, completion):
assert not completion
- @pytest.mark.complete("groupadd -")
+ @pytest.mark.complete("groupadd -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_groupdel.py b/test/t/test_groupdel.py
index 1409e6cc..6e558395 100644
--- a/test/t/test_groupdel.py
+++ b/test/t/test_groupdel.py
@@ -5,3 +5,7 @@ class TestGroupdel:
@pytest.mark.complete("groupdel ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("groupdel -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_groupmems.py b/test/t/test_groupmems.py
index 2faff633..c7b99208 100644
--- a/test/t/test_groupmems.py
+++ b/test/t/test_groupmems.py
@@ -2,6 +2,6 @@ import pytest
class TestGroupmems:
- @pytest.mark.complete("groupmems -")
+ @pytest.mark.complete("groupmems -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_groupmod.py b/test/t/test_groupmod.py
index 08b1d2e2..7097118f 100644
--- a/test/t/test_groupmod.py
+++ b/test/t/test_groupmod.py
@@ -6,6 +6,6 @@ class TestGroupmod:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("groupmod -")
+ @pytest.mark.complete("groupmod -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_grpck.py b/test/t/test_grpck.py
index 0d6a5cef..dcd14850 100644
--- a/test/t/test_grpck.py
+++ b/test/t/test_grpck.py
@@ -6,6 +6,6 @@ class TestGrpck:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("grpck -")
+ @pytest.mark.complete("grpck -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_grub.py b/test/t/test_grub.py
index 8ecd0209..4a6929ff 100644
--- a/test/t/test_grub.py
+++ b/test/t/test_grub.py
@@ -2,6 +2,6 @@ import pytest
class TestGrub:
- @pytest.mark.complete("grub --")
+ @pytest.mark.complete("grub --", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_gssdp_discover.py b/test/t/test_gssdp_discover.py
new file mode 100644
index 00000000..b5451496
--- /dev/null
+++ b/test/t/test_gssdp_discover.py
@@ -0,0 +1,22 @@
+import pytest
+
+
+@pytest.mark.bashcomp(cmd="gssdp-discover")
+class TestGssdpDiscover:
+ @pytest.mark.complete("gssdp-discover ")
+ def test_no_args(self, completion):
+ assert not completion
+
+ @pytest.mark.complete("gssdp-discover --", require_cmd=True)
+ def test_options(self, completion):
+ assert completion
+
+ @pytest.mark.complete(
+ "gssdp-discover --message-type=",
+ skipif=(
+ "! gssdp-discover --help 2>&1 "
+ "| command grep -qF -- --message-type"
+ ),
+ )
+ def test_message_type(self, completion):
+ assert completion
diff --git a/test/t/test_gzip.py b/test/t/test_gzip.py
index 3c2ecb6f..2173cad9 100644
--- a/test/t/test_gzip.py
+++ b/test/t/test_gzip.py
@@ -9,3 +9,7 @@ class TestGzip:
@pytest.mark.complete("gzip ~")
def test_2(self, completion):
assert completion
+
+ @pytest.mark.complete("gzip -", require_cmd=True)
+ def test_3(self, completion):
+ assert completion
diff --git a/test/t/test_hcitool.py b/test/t/test_hcitool.py
index 8725533f..08853855 100644
--- a/test/t/test_hcitool.py
+++ b/test/t/test_hcitool.py
@@ -5,3 +5,7 @@ class TestHcitool:
@pytest.mark.complete("hcitool ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("hcitool -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_head.py b/test/t/test_head.py
index a287034a..815b938c 100644
--- a/test/t/test_head.py
+++ b/test/t/test_head.py
@@ -2,6 +2,6 @@ import pytest
class TestHead:
- @pytest.mark.complete("head --", skipif="! head --help &>/dev/null")
+ @pytest.mark.complete("head --", require_longopt=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_hexdump.py b/test/t/test_hexdump.py
index 82b6d2ba..03a7b1f2 100644
--- a/test/t/test_hexdump.py
+++ b/test/t/test_hexdump.py
@@ -2,6 +2,6 @@ import pytest
class TestHexdump:
- @pytest.mark.complete("hexdump -")
+ @pytest.mark.complete("hexdump -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_host.py b/test/t/test_host.py
index 555a36f5..2ef17908 100644
--- a/test/t/test_host.py
+++ b/test/t/test_host.py
@@ -2,6 +2,6 @@ import pytest
class TestHost:
- @pytest.mark.complete("host -")
+ @pytest.mark.complete("host -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_hostname.py b/test/t/test_hostname.py
index 5ccdf458..f644c1ea 100644
--- a/test/t/test_hostname.py
+++ b/test/t/test_hostname.py
@@ -2,6 +2,6 @@ import pytest
class TestHostname:
- @pytest.mark.complete("hostname -")
+ @pytest.mark.complete("hostname -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_hping2.py b/test/t/test_hping2.py
index 77e2ee26..19665ba3 100644
--- a/test/t/test_hping2.py
+++ b/test/t/test_hping2.py
@@ -5,3 +5,7 @@ class TestHping2:
@pytest.mark.complete("hping2 ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("hping2 -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_htop.py b/test/t/test_htop.py
index 62022bbd..e837c5ad 100644
--- a/test/t/test_htop.py
+++ b/test/t/test_htop.py
@@ -2,6 +2,6 @@ import pytest
class TestHtop:
- @pytest.mark.complete("htop -")
+ @pytest.mark.complete("htop -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_htpasswd.py b/test/t/test_htpasswd.py
index c17c0585..92989fa2 100644
--- a/test/t/test_htpasswd.py
+++ b/test/t/test_htpasswd.py
@@ -17,3 +17,7 @@ class TestHtpasswd:
@pytest.mark.complete("htpasswd -D htpasswd ", cwd="htpasswd")
def test_4(self, completion):
assert completion == "foo quux".split()
+
+ @pytest.mark.complete("htpasswd -", require_cmd=True)
+ def test_5(self, completion):
+ assert completion
diff --git a/test/t/test_hunspell.py b/test/t/test_hunspell.py
index 94ea1020..0f27185c 100644
--- a/test/t/test_hunspell.py
+++ b/test/t/test_hunspell.py
@@ -6,6 +6,6 @@ class TestHunspell:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("hunspell -")
+ @pytest.mark.complete("hunspell -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_hwclock.py b/test/t/test_hwclock.py
index a9cb30fa..47172103 100644
--- a/test/t/test_hwclock.py
+++ b/test/t/test_hwclock.py
@@ -2,6 +2,6 @@ import pytest
class TestHwclock:
- @pytest.mark.complete("hwclock -")
+ @pytest.mark.complete("hwclock -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_iconv.py b/test/t/test_iconv.py
index dc5f8961..f42a87fe 100644
--- a/test/t/test_iconv.py
+++ b/test/t/test_iconv.py
@@ -2,10 +2,20 @@ import pytest
class TestIconv:
- @pytest.mark.complete("iconv -")
+ @pytest.mark.complete(
+ "iconv -", require_cmd=True, xfail="! iconv --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
- @pytest.mark.complete("iconv -f UTF")
+ @pytest.mark.complete("iconv -f UTF", require_cmd=True)
def test_2(self, completion):
assert completion
+
+ @pytest.mark.complete("iconv ")
+ def test_3(self, completion):
+ assert completion
+
+ @pytest.mark.complete("iconv -f ")
+ def test_4(self, completion):
+ assert "..." not in completion
diff --git a/test/t/test_identify.py b/test/t/test_identify.py
index 12fba008..34ae2854 100644
--- a/test/t/test_identify.py
+++ b/test/t/test_identify.py
@@ -2,6 +2,6 @@ import pytest
class TestIdentify:
- @pytest.mark.complete("identify -")
+ @pytest.mark.complete("identify -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_idn.py b/test/t/test_idn.py
index 1fd1ce02..78172c0a 100644
--- a/test/t/test_idn.py
+++ b/test/t/test_idn.py
@@ -2,6 +2,6 @@ import pytest
class TestIdn:
- @pytest.mark.complete("idn -")
+ @pytest.mark.complete("idn -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_ifdown.py b/test/t/test_ifdown.py
index 16447be5..e91e4bac 100644
--- a/test/t/test_ifdown.py
+++ b/test/t/test_ifdown.py
@@ -1,10 +1,10 @@
import pytest
-from conftest import in_docker
+from conftest import in_container
class TestIfdown:
- @pytest.mark.xfail(in_docker(), reason="Probably fails in docker")
+ @pytest.mark.xfail(in_container(), reason="Probably fails in a container")
@pytest.mark.complete("ifdown ")
def test_1(self, completion):
assert completion
diff --git a/test/t/test_ifstat.py b/test/t/test_ifstat.py
index e4d828ee..89b5a0ec 100644
--- a/test/t/test_ifstat.py
+++ b/test/t/test_ifstat.py
@@ -2,18 +2,20 @@ import pytest
class TestIfstat:
- @pytest.mark.complete("ifstat -")
+ @pytest.mark.complete("ifstat -", require_cmd=True)
def test_1(self, completion):
assert completion
@pytest.mark.complete(
- "ifstat -i ", skipif="ifstat -v | command grep -qF iproute2"
+ "ifstat -i ", xfail="ifstat -v | command grep -qF iproute2"
)
def test_2(self, completion):
assert completion
@pytest.mark.complete(
- "ifstat -d ", skipif="ifstat -v | command grep -qF iproute2"
+ "ifstat -d ",
+ require_cmd=True,
+ xfail="ifstat -v | command grep -qF iproute2",
)
def test_3(self, completion):
assert completion
diff --git a/test/t/test_iftop.py b/test/t/test_iftop.py
index 9a25c28a..44973105 100644
--- a/test/t/test_iftop.py
+++ b/test/t/test_iftop.py
@@ -2,6 +2,10 @@ import pytest
class TestIftop:
- @pytest.mark.complete("iftop ")
+ @pytest.mark.complete("iftop ", require_cmd=True)
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("iftop -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_ifup.py b/test/t/test_ifup.py
index 62d8eb4a..843190e4 100644
--- a/test/t/test_ifup.py
+++ b/test/t/test_ifup.py
@@ -1,15 +1,17 @@
import pytest
-from conftest import in_docker
+from conftest import in_container
class TestIfup:
- @pytest.mark.xfail(in_docker(), reason="Probably fails in docker")
+ @pytest.mark.xfail(in_container(), reason="Probably fails in a container")
@pytest.mark.complete("ifup ")
def test_1(self, completion):
assert completion
- @pytest.mark.complete("ifup --", skipif="! ifup --help &>/dev/null")
+ @pytest.mark.complete(
+ "ifup -", require_cmd=True, skipif="! ifup --help &>/dev/null"
+ )
def test_2(self, completion):
assert completion
diff --git a/test/t/test_influx.py b/test/t/test_influx.py
new file mode 100644
index 00000000..53a15bff
--- /dev/null
+++ b/test/t/test_influx.py
@@ -0,0 +1,15 @@
+import pytest
+
+
+class TestInflux:
+ @pytest.mark.complete("influx ")
+ def test_nothing(self, completion):
+ assert not completion
+
+ @pytest.mark.complete("influx -", require_cmd=True)
+ def test_options(self, completion):
+ assert completion
+
+ @pytest.mark.complete("influx -format ", require_cmd=True)
+ def test_format(self, completion):
+ assert completion
diff --git a/test/t/test_info.py b/test/t/test_info.py
index b52b682e..e12d900f 100644
--- a/test/t/test_info.py
+++ b/test/t/test_info.py
@@ -7,6 +7,6 @@ class TestInfo:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("info -")
+ @pytest.mark.complete("info -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_inotifywait.py b/test/t/test_inotifywait.py
index fe647ad6..19fa4d54 100644
--- a/test/t/test_inotifywait.py
+++ b/test/t/test_inotifywait.py
@@ -6,10 +6,10 @@ class TestInotifywait:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("inotifywait --")
+ @pytest.mark.complete("inotifywait --", require_cmd=True)
def test_2(self, completion):
assert completion
- @pytest.mark.complete("inotifywait -e ")
+ @pytest.mark.complete("inotifywait -e ", require_cmd=True)
def test_3(self, completion):
assert completion
diff --git a/test/t/test_inotifywatch.py b/test/t/test_inotifywatch.py
index e0e686e8..281fec49 100644
--- a/test/t/test_inotifywatch.py
+++ b/test/t/test_inotifywatch.py
@@ -6,10 +6,10 @@ class TestInotifywatch:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("inotifywatch --")
+ @pytest.mark.complete("inotifywatch --", require_cmd=True)
def test_2(self, completion):
assert completion
- @pytest.mark.complete("inotifywatch -e ")
+ @pytest.mark.complete("inotifywatch -e ", require_cmd=True)
def test_3(self, completion):
assert len(completion) > 1
diff --git a/test/t/test_installpkg.py b/test/t/test_installpkg.py
index 4e5ab27c..e665f523 100644
--- a/test/t/test_installpkg.py
+++ b/test/t/test_installpkg.py
@@ -21,18 +21,18 @@ class TestInstallpkg:
dirs = sorted(x for x in os.listdir(".") if os.path.isdir("./%s" % x))
assert completion == ["%s/" % x for x in dirs]
- @pytest.mark.complete("installpkg --root ")
+ @pytest.mark.complete("installpkg ", cwd="slackware/home")
def test_4(self, completion):
expected = sorted(
[
"%s/" % x
for x in os.listdir("slackware/home")
- if os.path.isdir("./%s" % x)
+ if os.path.isdir("./slackware/home/%s" % x)
]
+ [
x
for x in os.listdir("slackware/home")
- if os.path.isfile("./%s" % x)
+ if os.path.isfile("./slackware/home/%s" % x)
and fnmatch.fnmatch(x, "*.t[bglx]z")
]
)
diff --git a/test/t/test_interdiff.py b/test/t/test_interdiff.py
index e681fd6c..83be115e 100644
--- a/test/t/test_interdiff.py
+++ b/test/t/test_interdiff.py
@@ -5,3 +5,7 @@ class TestInterdiff:
@pytest.mark.complete("interdiff ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("interdiff -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_ionice.py b/test/t/test_ionice.py
index ae047043..b097ebe0 100644
--- a/test/t/test_ionice.py
+++ b/test/t/test_ionice.py
@@ -2,6 +2,6 @@ import pytest
class TestIonice:
- @pytest.mark.complete("ionice -")
+ @pytest.mark.complete("ionice -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_iperf.py b/test/t/test_iperf.py
index 23f4df55..c38e9546 100644
--- a/test/t/test_iperf.py
+++ b/test/t/test_iperf.py
@@ -2,7 +2,7 @@ import pytest
class TestIperf:
- @pytest.mark.complete("iperf ")
+ @pytest.mark.complete("iperf ", require_cmd=True)
def test_1(self, completion):
assert completion
@@ -10,11 +10,15 @@ class TestIperf:
def test_2(self, completion):
assert completion
- @pytest.mark.complete("iperf --client foo --")
+ @pytest.mark.complete("iperf --client foo --", require_cmd=True)
def test_3(self, completion):
assert completion
assert "--daemon" not in completion
- @pytest.mark.complete("iperf --server --")
+ @pytest.mark.complete("iperf --server --", require_cmd=True)
def test_4(self, completion):
assert "--daemon" in completion
+
+ @pytest.mark.complete("iperf -", require_cmd=True)
+ def test_5(self, completion):
+ assert completion
diff --git a/test/t/test_iperf3.py b/test/t/test_iperf3.py
index cd93a996..15f3a03b 100644
--- a/test/t/test_iperf3.py
+++ b/test/t/test_iperf3.py
@@ -2,7 +2,7 @@ import pytest
class TestIperf3:
- @pytest.mark.complete("iperf3 ")
+ @pytest.mark.complete("iperf3 ", require_cmd=True)
def test_1(self, completion):
assert completion
@@ -10,11 +10,11 @@ class TestIperf3:
def test_2(self, completion):
assert completion
- @pytest.mark.complete("iperf3 --client foo --")
+ @pytest.mark.complete("iperf3 --client foo --", require_cmd=True)
def test_3(self, completion):
assert completion
assert "--daemon" not in completion
- @pytest.mark.complete("iperf3 --server --")
+ @pytest.mark.complete("iperf3 --server --", require_cmd=True)
def test_4(self, completion):
assert "--daemon" in completion
diff --git a/test/t/test_ipmitool.py b/test/t/test_ipmitool.py
index 5f50ec79..f779f910 100644
--- a/test/t/test_ipmitool.py
+++ b/test/t/test_ipmitool.py
@@ -5,3 +5,7 @@ class TestIpmitool:
@pytest.mark.complete("ipmitool ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("ipmitool -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_iptables.py b/test/t/test_iptables.py
index 7a30bb82..a5c82e5a 100644
--- a/test/t/test_iptables.py
+++ b/test/t/test_iptables.py
@@ -2,6 +2,6 @@ import pytest
class TestIptables:
- @pytest.mark.complete("iptables -")
+ @pytest.mark.complete("iptables -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_ipv6calc.py b/test/t/test_ipv6calc.py
index 435af149..872d8a37 100644
--- a/test/t/test_ipv6calc.py
+++ b/test/t/test_ipv6calc.py
@@ -2,10 +2,10 @@ import pytest
class TestIpv6calc:
- @pytest.mark.complete("ipv6calc -")
+ @pytest.mark.complete("ipv6calc -", require_cmd=True)
def test_1(self, completion):
- assert completion
+ assert "--action" in completion
- @pytest.mark.complete("ipv6calc --in ")
+ @pytest.mark.complete("ipv6calc --in ", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_irb.py b/test/t/test_irb.py
index 31c46e20..03a83c66 100644
--- a/test/t/test_irb.py
+++ b/test/t/test_irb.py
@@ -5,3 +5,7 @@ class TestIrb:
@pytest.mark.complete("irb ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("irb -", require_cmd=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_isort.py b/test/t/test_isort.py
index 4fae3244..9f7a6524 100644
--- a/test/t/test_isort.py
+++ b/test/t/test_isort.py
@@ -6,6 +6,6 @@ class TestIsort:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("isort -")
+ @pytest.mark.complete("isort -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_java.py b/test/t/test_java.py
index 81f07c68..ce0f7733 100644
--- a/test/t/test_java.py
+++ b/test/t/test_java.py
@@ -1,25 +1,44 @@
import pytest
+from conftest import is_bash_type
+
@pytest.mark.bashcomp(
pre_cmds=("CLASSPATH=$PWD/java/a:$PWD/java/bashcomp.jar",)
)
class TestJava:
- @pytest.mark.complete("java -")
+ @pytest.fixture(scope="class")
+ def can_list_jar(self, bash):
+ return (
+ is_bash_type(bash, "zipinfo")
+ or is_bash_type(bash, "unzip")
+ or is_bash_type(bash, "jar")
+ )
+
+ @pytest.mark.complete("java -", require_cmd=True)
def test_1(self, completion):
assert completion
@pytest.mark.complete("java ")
- def test_2(self, completion):
- assert completion == "b bashcomp.jarred c. toplevel".split()
+ def test_2(self, completion, can_list_jar):
+ if can_list_jar:
+ assert completion == "b bashcomp.jarred c. toplevel".split()
+ else:
+ assert completion == "b c.".split()
@pytest.mark.complete("java -classpath java/bashcomp.jar ")
- def test_3(self, completion):
- assert completion == "bashcomp.jarred toplevel".split()
+ def test_3(self, completion, can_list_jar):
+ if can_list_jar:
+ assert completion == "bashcomp.jarred toplevel".split()
+ else:
+ assert not completion
@pytest.mark.complete("java -cp java/bashcomp.jar:java/a/c ")
- def test_4(self, completion):
- assert completion == "bashcomp.jarred d toplevel".split()
+ def test_4(self, completion, can_list_jar):
+ if can_list_jar:
+ assert completion == "bashcomp.jarred d toplevel".split()
+ else:
+ assert completion == ["d"]
@pytest.mark.complete("java -cp '' ")
def test_5(self, completion):
diff --git a/test/t/test_javaws.py b/test/t/test_javaws.py
index 9f51c58b..596c7352 100644
--- a/test/t/test_javaws.py
+++ b/test/t/test_javaws.py
@@ -5,3 +5,7 @@ class TestJavaws:
@pytest.mark.complete("javaws ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("javaws -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_jpegoptim.py b/test/t/test_jpegoptim.py
index 01eb739c..fb525910 100644
--- a/test/t/test_jpegoptim.py
+++ b/test/t/test_jpegoptim.py
@@ -5,3 +5,7 @@ class TestJpegoptim:
@pytest.mark.complete("jpegoptim ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("jpegoptim -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_jq.py b/test/t/test_jq.py
index c858411f..47014143 100644
--- a/test/t/test_jq.py
+++ b/test/t/test_jq.py
@@ -12,8 +12,7 @@ class TestJq:
@pytest.mark.complete(
"jq -",
- skipif="! (jq --help 2>&1 || :) | "
- "command grep -qF 'options include'",
+ xfail="! (jq --help 2>&1 || :) | command grep -qF 'options include'",
)
def test_3(self, completion):
assert completion
diff --git a/test/t/test_jshint.py b/test/t/test_jshint.py
index 511e7c9d..58049d14 100644
--- a/test/t/test_jshint.py
+++ b/test/t/test_jshint.py
@@ -5,3 +5,7 @@ class TestJshint:
@pytest.mark.complete("jshint ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("jshint -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_jsonschema.py b/test/t/test_jsonschema.py
index 0905fd7f..9e3929e6 100644
--- a/test/t/test_jsonschema.py
+++ b/test/t/test_jsonschema.py
@@ -6,6 +6,6 @@ class TestJsonschema:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("jsonschema -")
+ @pytest.mark.complete("jsonschema -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_k3b.py b/test/t/test_k3b.py
index d9940ba5..61b6a4d5 100644
--- a/test/t/test_k3b.py
+++ b/test/t/test_k3b.py
@@ -5,3 +5,7 @@ class TestK3b:
@pytest.mark.complete("k3b ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("k3b -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_kcov.py b/test/t/test_kcov.py
index ce985a78..3c7d3dfa 100644
--- a/test/t/test_kcov.py
+++ b/test/t/test_kcov.py
@@ -6,7 +6,7 @@ class TestKcov:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("kcov --exclude-patter")
+ @pytest.mark.complete("kcov --exclude-patter", require_cmd=True)
def test_2(self, completion):
assert completion == "--exclude-pattern="
assert completion.endswith("=")
diff --git a/test/t/test_kdvi.py b/test/t/test_kdvi.py
index 7fb11cb0..c2ab011a 100644
--- a/test/t/test_kdvi.py
+++ b/test/t/test_kdvi.py
@@ -4,7 +4,7 @@ import pytest
class TestKdvi:
@pytest.mark.complete("kdvi ", cwd="kdvi")
def test_1(self, completion):
- assert (
- completion == "foo/ .dvi .DVI .dvi.bz2 .DVI.bz2 .dvi.gz "
+ assert completion == sorted(
+ "foo/ .dvi .DVI .dvi.bz2 .DVI.bz2 .dvi.gz "
".DVI.gz .dvi.Z .DVI.Z".split()
)
diff --git a/test/t/test_kill.py b/test/t/test_kill.py
index 59d5fa2b..9699435c 100644
--- a/test/t/test_kill.py
+++ b/test/t/test_kill.py
@@ -2,7 +2,7 @@ import pytest
class TestKill:
- @pytest.mark.complete("kill 1", skipif="! type ps &>/dev/null")
+ @pytest.mark.complete("kill 1", xfail="! type ps &>/dev/null")
def test_1(self, completion):
assert completion
diff --git a/test/t/test_killall.py b/test/t/test_killall.py
index 725a16e4..4b67d961 100644
--- a/test/t/test_killall.py
+++ b/test/t/test_killall.py
@@ -11,3 +11,11 @@ class TestKillall:
@pytest.mark.complete("killall --signal ")
def test_2(self, completion):
assert all(x in completion for x in "INT KILL TERM".split())
+
+ @pytest.mark.complete("killall ")
+ def test_3(self, completion):
+ assert "command=" not in completion
+
+ @pytest.mark.complete("killall -", require_cmd=True)
+ def test_4(self, completion):
+ assert completion
diff --git a/test/t/test_koji.py b/test/t/test_koji.py
index 68a8477b..73d3e4c2 100644
--- a/test/t/test_koji.py
+++ b/test/t/test_koji.py
@@ -2,10 +2,10 @@ import pytest
class TestKoji:
- @pytest.mark.complete("koji ")
+ @pytest.mark.complete("koji ", require_cmd=True)
def test_1(self, completion):
assert completion
- @pytest.mark.complete("koji -")
+ @pytest.mark.complete("koji -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_kpdf.py b/test/t/test_kpdf.py
index ceee34d3..68b36fe8 100644
--- a/test/t/test_kpdf.py
+++ b/test/t/test_kpdf.py
@@ -4,4 +4,4 @@ import pytest
class TestKpdf:
@pytest.mark.complete("kpdf ", cwd="kpdf")
def test_1(self, completion):
- assert completion == "foo/ .eps .ps .EPS .PS .pdf .PDF".split()
+ assert completion == sorted("foo/ .eps .ps .EPS .PS .pdf .PDF".split())
diff --git a/test/t/test_l2ping.py b/test/t/test_l2ping.py
index 7979d734..c50651b7 100644
--- a/test/t/test_l2ping.py
+++ b/test/t/test_l2ping.py
@@ -2,6 +2,6 @@ import pytest
class TestL2ping:
- @pytest.mark.complete("l2ping -")
+ @pytest.mark.complete("l2ping -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_lastlog.py b/test/t/test_lastlog.py
index 043af962..31a855fb 100644
--- a/test/t/test_lastlog.py
+++ b/test/t/test_lastlog.py
@@ -2,6 +2,6 @@ import pytest
class TestLastlog:
- @pytest.mark.complete("lastlog -")
+ @pytest.mark.complete("lastlog -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_ld.py b/test/t/test_ld.py
index a82f091b..f6a16bb2 100644
--- a/test/t/test_ld.py
+++ b/test/t/test_ld.py
@@ -5,3 +5,7 @@ class TestLd:
@pytest.mark.complete("ld ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("ld -", require_cmd=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_ldapvi.py b/test/t/test_ldapvi.py
index a81ae180..5e65fc46 100644
--- a/test/t/test_ldapvi.py
+++ b/test/t/test_ldapvi.py
@@ -2,6 +2,6 @@ import pytest
class TestLdapvi:
- @pytest.mark.complete("ldapvi -")
+ @pytest.mark.complete("ldapvi -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_ldd.py b/test/t/test_ldd.py
index 8c463b60..70e295a5 100644
--- a/test/t/test_ldd.py
+++ b/test/t/test_ldd.py
@@ -5,3 +5,7 @@ class TestLdd:
@pytest.mark.complete("ldd ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("ldd -", require_cmd=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_less.py b/test/t/test_less.py
index 79cdf183..0b14e21e 100644
--- a/test/t/test_less.py
+++ b/test/t/test_less.py
@@ -2,6 +2,6 @@ import pytest
class TestLess:
- @pytest.mark.complete("less --")
+ @pytest.mark.complete("less --", require_longopt=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_lftp.py b/test/t/test_lftp.py
index 18506f61..765e51e1 100644
--- a/test/t/test_lftp.py
+++ b/test/t/test_lftp.py
@@ -12,3 +12,7 @@ class TestLftp:
).split()
assert all(x in completion for x in hosts)
assert "lftptest" in completion # defined in lftp/.lftp/bookmarks
+
+ @pytest.mark.complete("lftp -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_links.py b/test/t/test_links.py
index f21b8728..0806813d 100644
--- a/test/t/test_links.py
+++ b/test/t/test_links.py
@@ -6,6 +6,6 @@ class TestLinks:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("links -")
+ @pytest.mark.complete("links -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_lintian_info.py b/test/t/test_lintian_info.py
index 6bcc9e52..bf9afc52 100644
--- a/test/t/test_lintian_info.py
+++ b/test/t/test_lintian_info.py
@@ -7,6 +7,6 @@ class TestLintianInfo:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("lintian-info --")
+ @pytest.mark.complete("lintian-info --", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_ln.py b/test/t/test_ln.py
index de053345..6bf809c6 100644
--- a/test/t/test_ln.py
+++ b/test/t/test_ln.py
@@ -5,3 +5,7 @@ class TestLn:
@pytest.mark.complete("ln ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("ln -", require_longopt=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_locale_gen.py b/test/t/test_locale_gen.py
index 41ac376f..caffb067 100644
--- a/test/t/test_locale_gen.py
+++ b/test/t/test_locale_gen.py
@@ -3,10 +3,11 @@ import pytest
@pytest.mark.bashcomp(cmd="locale-gen")
class TestLocaleGen:
- @pytest.mark.complete("locale-gen ")
+ # require_cmd is not strictly true here, but...
+ @pytest.mark.complete("locale-gen ", require_cmd=True)
def test_1(self, completion):
assert completion
- @pytest.mark.complete("locale-gen --")
+ @pytest.mark.complete("locale-gen --", require_longopt=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_lrzip.py b/test/t/test_lrzip.py
index 266d8a30..d61ee9d1 100644
--- a/test/t/test_lrzip.py
+++ b/test/t/test_lrzip.py
@@ -9,3 +9,7 @@ class TestLrzip:
@pytest.mark.complete("lrzip ~")
def test_2(self, completion):
assert completion
+
+ @pytest.mark.complete("lrzip -", require_cmd=True)
+ def test_3(self, completion):
+ assert completion
diff --git a/test/t/test_ls.py b/test/t/test_ls.py
index ed5ad9c4..7e2d1f35 100644
--- a/test/t/test_ls.py
+++ b/test/t/test_ls.py
@@ -8,7 +8,9 @@ from conftest import (
class TestLs:
- @pytest.mark.complete("ls --", skipif="! ls --help &>/dev/null")
+ @pytest.mark.complete(
+ "ls --", require_cmd=True, xfail="! ls --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_lspci.py b/test/t/test_lspci.py
index 44663426..ac18da3f 100644
--- a/test/t/test_lspci.py
+++ b/test/t/test_lspci.py
@@ -2,10 +2,10 @@ import pytest
class TestLspci:
- @pytest.mark.complete("lspci -")
+ @pytest.mark.complete("lspci -", require_cmd=True)
def test_1(self, completion):
assert completion
- @pytest.mark.complete("lspci -A ")
+ @pytest.mark.complete("lspci -A ", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_lsscsi.py b/test/t/test_lsscsi.py
index a297b375..fe01ac15 100644
--- a/test/t/test_lsscsi.py
+++ b/test/t/test_lsscsi.py
@@ -6,6 +6,6 @@ class TestLsscsi:
def test_1(self, completion):
assert not completion
- @pytest.mark.complete("lsscsi -")
+ @pytest.mark.complete("lsscsi -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_lsusb.py b/test/t/test_lsusb.py
index 9c546d32..c68d046b 100644
--- a/test/t/test_lsusb.py
+++ b/test/t/test_lsusb.py
@@ -2,6 +2,9 @@ import pytest
class TestLsusb:
- @pytest.mark.complete("lsusb -")
+ @pytest.mark.complete(
+ "lsusb -",
+ xfail="! (lsusb --help 2>&1 || :) | command grep -qF -- --help",
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_lua.py b/test/t/test_lua.py
index edcae883..54c24321 100644
--- a/test/t/test_lua.py
+++ b/test/t/test_lua.py
@@ -5,3 +5,7 @@ class TestLua:
@pytest.mark.complete("lua ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("lua -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_luac.py b/test/t/test_luac.py
index f14d400a..28dc0e85 100644
--- a/test/t/test_luac.py
+++ b/test/t/test_luac.py
@@ -5,3 +5,7 @@ class TestLuac:
@pytest.mark.complete("luac ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("luac -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_luseradd.py b/test/t/test_luseradd.py
index 35c89e54..4f1bec9c 100644
--- a/test/t/test_luseradd.py
+++ b/test/t/test_luseradd.py
@@ -2,6 +2,6 @@ import pytest
class TestLuseradd:
- @pytest.mark.complete("luseradd -")
+ @pytest.mark.complete("luseradd -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_luserdel.py b/test/t/test_luserdel.py
index cdca2a57..ad88557c 100644
--- a/test/t/test_luserdel.py
+++ b/test/t/test_luserdel.py
@@ -5,3 +5,7 @@ class TestLuserdel:
@pytest.mark.complete("luserdel ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("luserdel -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_lvchange.py b/test/t/test_lvchange.py
index 5722a581..3e4feda5 100644
--- a/test/t/test_lvchange.py
+++ b/test/t/test_lvchange.py
@@ -3,7 +3,7 @@ import pytest
class TestLvchange:
@pytest.mark.complete(
- "lvchange --", skipif="! lvchange --help &>/dev/null"
+ "lvchange --", require_cmd=True, xfail="! lvchange --help &>/dev/null"
)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_lvcreate.py b/test/t/test_lvcreate.py
index e60432f6..636f6250 100644
--- a/test/t/test_lvcreate.py
+++ b/test/t/test_lvcreate.py
@@ -3,7 +3,7 @@ import pytest
class TestLvcreate:
@pytest.mark.complete(
- "lvcreate --", skipif="! lvcreate --help &>/dev/null"
+ "lvcreate --", require_cmd=True, xfail="! lvcreate --help &>/dev/null"
)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_lvdisplay.py b/test/t/test_lvdisplay.py
index e9a955ed..52106621 100644
--- a/test/t/test_lvdisplay.py
+++ b/test/t/test_lvdisplay.py
@@ -3,7 +3,9 @@ import pytest
class TestLvdisplay:
@pytest.mark.complete(
- "lvdisplay --", skipif="! lvdisplay --help &>/dev/null"
+ "lvdisplay --",
+ require_cmd=True,
+ xfail="! lvdisplay --help &>/dev/null",
)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_lvextend.py b/test/t/test_lvextend.py
index 68e17848..4daa8887 100644
--- a/test/t/test_lvextend.py
+++ b/test/t/test_lvextend.py
@@ -3,7 +3,7 @@ import pytest
class TestLvextend:
@pytest.mark.complete(
- "lvextend --", skipif="! lvextend --help &>/dev/null"
+ "lvextend --", require_cmd=True, xfail="! lvextend --help &>/dev/null"
)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_lvmdiskscan.py b/test/t/test_lvmdiskscan.py
index 0716d5c4..1b334b89 100644
--- a/test/t/test_lvmdiskscan.py
+++ b/test/t/test_lvmdiskscan.py
@@ -3,7 +3,9 @@ import pytest
class TestLvmdiskscan:
@pytest.mark.complete(
- "lvmdiskscan --", skipif="! lvmdiskscan --help &>/dev/null"
+ "lvmdiskscan --",
+ require_cmd=True,
+ xfail="! lvmdiskscan --help &>/dev/null",
)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_lvreduce.py b/test/t/test_lvreduce.py
index 50b038fd..3b614cb9 100644
--- a/test/t/test_lvreduce.py
+++ b/test/t/test_lvreduce.py
@@ -3,7 +3,7 @@ import pytest
class TestLvreduce:
@pytest.mark.complete(
- "lvreduce --", skipif="! lvreduce --help &>/dev/null"
+ "lvreduce --", require_cmd=True, xfail="! lvreduce --help &>/dev/null"
)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_lvremove.py b/test/t/test_lvremove.py
index 53950aec..17486aa0 100644
--- a/test/t/test_lvremove.py
+++ b/test/t/test_lvremove.py
@@ -3,7 +3,7 @@ import pytest
class TestLvremove:
@pytest.mark.complete(
- "lvremove --", skipif="! lvremove --help &>/dev/null"
+ "lvremove --", require_cmd=True, xfail="! lvremove --help &>/dev/null"
)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_lvrename.py b/test/t/test_lvrename.py
index c60469f5..802b72e7 100644
--- a/test/t/test_lvrename.py
+++ b/test/t/test_lvrename.py
@@ -3,7 +3,7 @@ import pytest
class TestLvrename:
@pytest.mark.complete(
- "lvrename --", skipif="! lvrename --help &>/dev/null"
+ "lvrename --", require_cmd=True, xfail="! lvrename --help &>/dev/null"
)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_lvresize.py b/test/t/test_lvresize.py
index aecc8bf4..bb71feb1 100644
--- a/test/t/test_lvresize.py
+++ b/test/t/test_lvresize.py
@@ -3,7 +3,7 @@ import pytest
class TestLvresize:
@pytest.mark.complete(
- "lvresize --", skipif="! lvresize --help &>/dev/null"
+ "lvresize --", require_cmd=True, xfail="! lvresize --help &>/dev/null"
)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_lvs.py b/test/t/test_lvs.py
index 456368b9..eadc8df5 100644
--- a/test/t/test_lvs.py
+++ b/test/t/test_lvs.py
@@ -2,6 +2,8 @@ import pytest
class TestLvs:
- @pytest.mark.complete("lvs --", skipif="! lvs --help &>/dev/null")
+ @pytest.mark.complete(
+ "lvs --", require_cmd=True, xfail="! lvs --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_lvscan.py b/test/t/test_lvscan.py
index 4848fe4c..a2867b06 100644
--- a/test/t/test_lvscan.py
+++ b/test/t/test_lvscan.py
@@ -2,6 +2,8 @@ import pytest
class TestLvscan:
- @pytest.mark.complete("lvscan --", skipif="! lvscan --help &>/dev/null")
+ @pytest.mark.complete(
+ "lvscan --", require_cmd=True, xfail="! lvscan --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_lz4.py b/test/t/test_lz4.py
index 0d873b66..0e1208c9 100644
--- a/test/t/test_lz4.py
+++ b/test/t/test_lz4.py
@@ -9,3 +9,7 @@ class TestLz4:
@pytest.mark.complete("lz4 ~")
def test_2(self, completion):
assert completion
+
+ @pytest.mark.complete("lz4 -", require_cmd=True)
+ def test_3(self, completion):
+ assert completion
diff --git a/test/t/test_lzip.py b/test/t/test_lzip.py
index 6f1dc023..b0313be4 100644
--- a/test/t/test_lzip.py
+++ b/test/t/test_lzip.py
@@ -5,3 +5,7 @@ class TestLzip:
@pytest.mark.complete("lzip ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("lzip -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_m4.py b/test/t/test_m4.py
index d80a7538..7ecd7745 100644
--- a/test/t/test_m4.py
+++ b/test/t/test_m4.py
@@ -2,6 +2,8 @@ import pytest
class TestM4:
- @pytest.mark.complete("m4 --", skipif="! m4 --help &>/dev/null")
+ @pytest.mark.complete(
+ "m4 --", require_cmd=True, xfail="! m4 --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_macof.py b/test/t/test_macof.py
index 8030c379..17f0eaea 100644
--- a/test/t/test_macof.py
+++ b/test/t/test_macof.py
@@ -2,6 +2,6 @@ import pytest
class TestMacof:
- @pytest.mark.complete("macof -")
+ @pytest.mark.complete("macof -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_mailsnarf.py b/test/t/test_mailsnarf.py
index 4e264a6e..0dc3e04e 100644
--- a/test/t/test_mailsnarf.py
+++ b/test/t/test_mailsnarf.py
@@ -2,6 +2,6 @@ import pytest
class TestMailsnarf:
- @pytest.mark.complete("mailsnarf -")
+ @pytest.mark.complete("mailsnarf -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_make.py b/test/t/test_make.py
index 9c76f83c..e6e043cd 100644
--- a/test/t/test_make.py
+++ b/test/t/test_make.py
@@ -2,7 +2,7 @@ import os
import pytest
-from conftest import in_docker
+from conftest import in_container
class TestMake:
@@ -35,7 +35,7 @@ class TestMake:
os.remove("%s/make/%s" % (bash.cwd, "extra_makefile"))
@pytest.mark.xfail(
- in_docker() and os.environ.get("DIST") == "centos6",
+ in_container() and os.environ.get("DIST") == "centos6",
reason="Fails for some unknown reason on CentOS 6, "
"even though the behavior appears to be correct",
)
@@ -48,3 +48,7 @@ class TestMake:
def test_8(self, bash, completion):
assert completion == "all clean extra_makefile install sample".split()
os.remove("%s/make/%s" % (bash.cwd, "extra_makefile"))
+
+ @pytest.mark.complete("make -", require_cmd=True)
+ def test_9(self, completion):
+ assert completion
diff --git a/test/t/test_makepkg.py b/test/t/test_makepkg.py
index 65f49ea8..f643a292 100644
--- a/test/t/test_makepkg.py
+++ b/test/t/test_makepkg.py
@@ -1,13 +1,16 @@
import pytest
-@pytest.mark.bashcomp(skipif="! makepkg --help 2>&1 | grep -qiF slackware")
+@pytest.mark.bashcomp(
+ ignore_env=r"^-declare -f _makepkg_bootstrap$",
+ xfail="! makepkg --help 2>&1 | command grep -qiF slackware",
+)
class TestMakepkg:
@pytest.mark.complete("makepkg ")
def test_1(self, completion):
assert completion
- @pytest.mark.complete("makepkg --")
+ @pytest.mark.complete("makepkg --", require_cmd=True)
def test_2(self, completion):
assert all(
x in completion for x in "--chown --linkadd --prepend".split()
diff --git a/test/t/test_man.py b/test/t/test_man.py
index 60021d99..ad36d96e 100644
--- a/test/t/test_man.py
+++ b/test/t/test_man.py
@@ -2,10 +2,12 @@ import os
import pytest
-from conftest import assert_bash_exec, in_docker
+from conftest import assert_bash_exec, in_container
-@pytest.mark.bashcomp(ignore_env=r"^[+-]MANPATH=")
+@pytest.mark.bashcomp(
+ ignore_env=r"^[+-]((BASHOPTS|MANPATH)=|shopt -. failglob)"
+)
class TestMan:
manpath = "$PWD/man"
@@ -29,7 +31,9 @@ class TestMan:
)
@pytest.mark.complete(
- "man bash-completion-testcas", env=dict(MANPATH=manpath)
+ "man bash-completion-testcas",
+ env=dict(MANPATH=manpath),
+ require_cmd=True,
)
def test_1(self, completion):
assert completion == "bash-completion-testcase"
@@ -43,7 +47,7 @@ class TestMan:
assert completion == "man/quux.8"
@pytest.mark.xfail(
- in_docker() and os.environ.get("DIST") == "centos6",
+ in_container() and os.environ.get("DIST") == "centos6",
reason="TODO: Fails in CentOS for some reason, unknown "
"how to trigger same behavior as tests show (is "
"different and correct when tried manually, but here "
@@ -64,6 +68,7 @@ class TestMan:
@pytest.mark.complete(
"man %s" % assumed_present,
+ require_cmd=True,
cwd="shared/empty_dir",
env=dict(MANPATH="%s:" % manpath),
)
@@ -72,13 +77,16 @@ class TestMan:
assert completion
@pytest.mark.complete(
- "man bash-completion-testcas", env=dict(MANPATH="%s:" % manpath)
+ "man bash-completion-testcas",
+ require_cmd=True,
+ env=dict(MANPATH="%s:" % manpath),
)
def test_6(self, completion):
assert completion == "bash-completion-testcase"
@pytest.mark.complete(
"man %s" % assumed_present,
+ require_cmd=True,
cwd="shared/empty_dir",
env=dict(MANPATH=":%s" % manpath),
)
@@ -87,13 +95,16 @@ class TestMan:
assert completion
@pytest.mark.complete(
- "man bash-completion-testcas", env=dict(MANPATH=":%s" % manpath)
+ "man bash-completion-testcas",
+ require_cmd=True,
+ env=dict(MANPATH=":%s" % manpath),
)
def test_8(self, completion):
assert completion == "bash-completion-testcase"
@pytest.mark.complete(
"man %s" % assumed_present,
+ require_cmd=True,
cwd="shared/empty_dir",
pre_cmds=("shopt -s failglob",),
)
@@ -102,7 +113,13 @@ class TestMan:
assert_bash_exec(bash, "shopt -u failglob")
@pytest.mark.complete(
- "man Bash::C", env=dict(MANPATH="%s:../tmp/man" % manpath)
+ "man Bash::C",
+ require_cmd=True,
+ env=dict(MANPATH="%s:../tmp/man" % manpath),
)
def test_10(self, bash, colonpath, completion):
assert completion == "Bash::Completion"
+
+ @pytest.mark.complete("man -", require_cmd=True)
+ def test_11(self, completion):
+ assert completion
diff --git a/test/t/test_mc.py b/test/t/test_mc.py
index 9632d6a9..31f88b78 100644
--- a/test/t/test_mc.py
+++ b/test/t/test_mc.py
@@ -2,6 +2,6 @@ import pytest
class TestMc:
- @pytest.mark.complete("mc -")
+ @pytest.mark.complete("mc -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_mcrypt.py b/test/t/test_mcrypt.py
index da80ef5d..d11f4467 100644
--- a/test/t/test_mcrypt.py
+++ b/test/t/test_mcrypt.py
@@ -6,10 +6,14 @@ class TestMcrypt:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("mcrypt -a ")
+ @pytest.mark.complete("mcrypt -a ", require_cmd=True)
def test_2(self, completion):
assert completion
- @pytest.mark.complete("mcrypt -m ")
+ @pytest.mark.complete("mcrypt -m ", require_cmd=True)
def test_3(self, completion):
assert completion
+
+ @pytest.mark.complete("mcrypt -", require_cmd=True)
+ def test_4(self, completion):
+ assert completion
diff --git a/test/t/test_md5sum.py b/test/t/test_md5sum.py
index fa364ea1..0a3286ad 100644
--- a/test/t/test_md5sum.py
+++ b/test/t/test_md5sum.py
@@ -5,3 +5,7 @@ class TestMd5sum:
@pytest.mark.complete("md5sum ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("md5sum -", require_longopt=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_medusa.py b/test/t/test_medusa.py
index bffa1c46..87fb91b7 100644
--- a/test/t/test_medusa.py
+++ b/test/t/test_medusa.py
@@ -2,6 +2,6 @@ import pytest
class TestMedusa:
- @pytest.mark.complete("medusa -")
+ @pytest.mark.complete("medusa -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_mencoder.py b/test/t/test_mencoder.py
index ba946c7e..a17fb960 100644
--- a/test/t/test_mencoder.py
+++ b/test/t/test_mencoder.py
@@ -7,6 +7,6 @@ class TestMencoder:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("mencoder -v")
+ @pytest.mark.complete("mencoder -v", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_mii_diag.py b/test/t/test_mii_diag.py
index fa527e94..6ed96aa9 100644
--- a/test/t/test_mii_diag.py
+++ b/test/t/test_mii_diag.py
@@ -6,3 +6,7 @@ class TestMiiDiag:
@pytest.mark.complete("mii-diag ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("mii-diag -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_mii_tool.py b/test/t/test_mii_tool.py
index 32568f82..f028787e 100644
--- a/test/t/test_mii_tool.py
+++ b/test/t/test_mii_tool.py
@@ -6,3 +6,7 @@ class TestMiiTool:
@pytest.mark.complete("mii-tool ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("mii-tool -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_minicom.py b/test/t/test_minicom.py
index c004fadd..6fac4570 100644
--- a/test/t/test_minicom.py
+++ b/test/t/test_minicom.py
@@ -2,6 +2,6 @@ import pytest
class TestMinicom:
- @pytest.mark.complete("minicom -")
+ @pytest.mark.complete("minicom -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_mkdir.py b/test/t/test_mkdir.py
index a5eb1a54..1b9cb9dc 100644
--- a/test/t/test_mkdir.py
+++ b/test/t/test_mkdir.py
@@ -16,3 +16,7 @@ class TestMkdir:
def test_3(self, completion):
assert completion.output == "foo"
assert completion == [completion.output]
+
+ @pytest.mark.complete("mkdir -", require_longopt=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_mkfifo.py b/test/t/test_mkfifo.py
index b9e0013c..92e82de7 100644
--- a/test/t/test_mkfifo.py
+++ b/test/t/test_mkfifo.py
@@ -5,3 +5,7 @@ class TestMkfifo:
@pytest.mark.complete("mkfifo ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("mkfifo -", require_longopt=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_mknod.py b/test/t/test_mknod.py
index 46cb2284..03f21e8c 100644
--- a/test/t/test_mknod.py
+++ b/test/t/test_mknod.py
@@ -5,3 +5,7 @@ class TestMknod:
@pytest.mark.complete("mknod ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("mknod -", require_longopt=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_mock.py b/test/t/test_mock.py
index 7dc5de2a..5f9eb3e0 100644
--- a/test/t/test_mock.py
+++ b/test/t/test_mock.py
@@ -5,3 +5,9 @@ class TestMock:
@pytest.mark.complete("mock ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete(
+ "mock -", require_cmd=True, xfail="! mock --help &>/dev/null"
+ )
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_modinfo.py b/test/t/test_modinfo.py
index 4c96eef0..a4f5c50a 100644
--- a/test/t/test_modinfo.py
+++ b/test/t/test_modinfo.py
@@ -4,14 +4,14 @@ import pytest
class TestModinfo:
- @pytest.mark.complete("modinfo -")
+ @pytest.mark.complete("modinfo -", require_cmd=True)
def test_1(self, completion):
assert completion
# "in": intel*, ...
@pytest.mark.complete(
"modinfo in",
- skipif="! ls /lib/modules/%s &>/dev/null"
+ xfail="! ls /lib/modules/%s &>/dev/null"
% subprocess.check_output(
"uname -r 2>/dev/null || " "echo non-existent-kernel", shell=True
)
diff --git a/test/t/test_modprobe.py b/test/t/test_modprobe.py
index 339240f6..38d290ae 100644
--- a/test/t/test_modprobe.py
+++ b/test/t/test_modprobe.py
@@ -11,7 +11,7 @@ class TestModprobe:
# "in": intel*, ...
@pytest.mark.complete(
"modprobe in",
- skipif="! ls /lib/modules/%s &>/dev/null"
+ xfail="! ls /lib/modules/%s &>/dev/null"
% subprocess.check_output(
"uname -r 2>/dev/null || " "echo non-existent-kernel", shell=True
)
diff --git a/test/t/test_monodevelop.py b/test/t/test_monodevelop.py
index 472b1aba..59435a16 100644
--- a/test/t/test_monodevelop.py
+++ b/test/t/test_monodevelop.py
@@ -5,3 +5,7 @@ class TestMonodevelop:
@pytest.mark.complete("monodevelop ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("monodevelop -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_mplayer.py b/test/t/test_mplayer.py
index 88d7b9f1..a06991b2 100644
--- a/test/t/test_mplayer.py
+++ b/test/t/test_mplayer.py
@@ -7,6 +7,6 @@ class TestMplayer:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("mplayer -h")
+ @pytest.mark.complete("mplayer -h", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_mr.py b/test/t/test_mr.py
index ab45350b..768e1b35 100644
--- a/test/t/test_mr.py
+++ b/test/t/test_mr.py
@@ -9,35 +9,47 @@ class TestMr:
# man -h tests below: Some mr versions require man to be around in order
# to provide useful output.
- @pytest.mark.complete("mr --", skipif="! man -h &>/dev/null")
+ @pytest.mark.complete(
+ "mr --", require_cmd=True, xfail="! man -h &>/dev/null"
+ )
def test_2(self, completion):
assert completion
@pytest.mark.complete(
- "mr -c shared/default/foo.d/", skipif="! man -h &>/dev/null"
+ "mr -c shared/default/foo.d/", xfail="! man -h &>/dev/null"
)
def test_3(self, completion):
assert completion == "shared/default/foo.d/foo"
@pytest.mark.complete(
- "mr bootstrap shared/default/", skipif="! man -h &>/dev/null"
+ "mr bootstrap shared/default/",
+ require_cmd=True,
+ xfail="! man -h &>/dev/null",
)
def test_4(self, completion):
assert completion == ["bar", "bar bar.d/", "foo", "foo.d/"]
@pytest.mark.xfail # "clean" doesn't exist before mr 1.20141023
- @pytest.mark.complete("mr clean -", skipif="! man -h &>/dev/null")
+ @pytest.mark.complete(
+ "mr clean -", require_cmd=True, xfail="! man -h &>/dev/null"
+ )
def test_5(self, completion):
assert completion == "-f"
- @pytest.mark.complete("mr commit -", skipif="! man -h &>/dev/null")
+ @pytest.mark.complete(
+ "mr commit -", require_cmd=True, xfail="! man -h &>/dev/null"
+ )
def test_6(self, completion):
assert completion == "-m"
- @pytest.mark.complete("mr status ", skipif="! man -h &>/dev/null")
+ @pytest.mark.complete(
+ "mr status ", require_cmd=True, xfail="! man -h &>/dev/null"
+ )
def test_7(self, completion):
assert not completion
- @pytest.mark.complete("mr run ", skipif="! man -h &>/dev/null")
+ @pytest.mark.complete(
+ "mr run ", require_cmd=True, xfail="! man -h &>/dev/null"
+ )
def test_8(self, completion):
assert completion
diff --git a/test/t/test_msgsnarf.py b/test/t/test_msgsnarf.py
index 5ef0fcb7..74844565 100644
--- a/test/t/test_msgsnarf.py
+++ b/test/t/test_msgsnarf.py
@@ -2,6 +2,6 @@ import pytest
class TestMsgsnarf:
- @pytest.mark.complete("msgsnarf -")
+ @pytest.mark.complete("msgsnarf -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_munin_node_configure.py b/test/t/test_munin_node_configure.py
index f3f23e7d..e7570d84 100644
--- a/test/t/test_munin_node_configure.py
+++ b/test/t/test_munin_node_configure.py
@@ -6,3 +6,14 @@ class TestMuninNodeConfigure:
@pytest.mark.complete("munin-node-configure --libdir ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete(
+ "munin-node-configure -",
+ require_cmd=True,
+ xfail=(
+ "! (munin-node-configure --help 2>&1 || :) "
+ "| command grep -q -- '[[:space:]]-'"
+ ),
+ )
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_munin_run.py b/test/t/test_munin_run.py
index 1bcb4d85..a0314495 100644
--- a/test/t/test_munin_run.py
+++ b/test/t/test_munin_run.py
@@ -3,6 +3,6 @@ import pytest
@pytest.mark.bashcomp(cmd="munin-run")
class TestMuninRun:
- @pytest.mark.complete("munin-run -")
+ @pytest.mark.complete("munin-run -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_munindoc.py b/test/t/test_munindoc.py
index 6b226e43..eea13caa 100644
--- a/test/t/test_munindoc.py
+++ b/test/t/test_munindoc.py
@@ -4,6 +4,7 @@ import pytest
class TestMunindoc:
# Assume at least munin* available
- @pytest.mark.complete("munindoc m")
+ # require_cmd is not strictly correct here, but...
+ @pytest.mark.complete("munindoc m", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_mussh.py b/test/t/test_mussh.py
index 87dd52a1..357c2b5b 100644
--- a/test/t/test_mussh.py
+++ b/test/t/test_mussh.py
@@ -2,6 +2,6 @@ import pytest
class TestMussh:
- @pytest.mark.complete("mussh -")
+ @pytest.mark.complete("mussh -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_mutt.py b/test/t/test_mutt.py
index b490c88b..0c4074f8 100644
--- a/test/t/test_mutt.py
+++ b/test/t/test_mutt.py
@@ -9,7 +9,7 @@ class TestMutt:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("mutt -F muttrc -f =", cwd="mutt")
+ @pytest.mark.complete("mutt -F muttrc -f =", require_cmd=True, cwd="mutt")
def test_2(self, completion):
assert completion == "bar/ foo/ muttrc".split()
diff --git a/test/t/test_mv.py b/test/t/test_mv.py
index a9fc969d..4a354db2 100644
--- a/test/t/test_mv.py
+++ b/test/t/test_mv.py
@@ -5,3 +5,7 @@ class TestMv:
@pytest.mark.complete("mv ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("mv -", require_longopt=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_mypy.py b/test/t/test_mypy.py
index cecea92d..63fc916c 100644
--- a/test/t/test_mypy.py
+++ b/test/t/test_mypy.py
@@ -6,7 +6,7 @@ class TestMypy:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("mypy --")
+ @pytest.mark.complete("mypy --", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_mysqladmin.py b/test/t/test_mysqladmin.py
index 74db63b0..85046fe5 100644
--- a/test/t/test_mysqladmin.py
+++ b/test/t/test_mysqladmin.py
@@ -2,6 +2,6 @@ import pytest
class TestMysqladmin:
- @pytest.mark.complete("mysqladmin -")
+ @pytest.mark.complete("mysqladmin -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_nc.py b/test/t/test_nc.py
index 6a50106e..38db5acd 100644
--- a/test/t/test_nc.py
+++ b/test/t/test_nc.py
@@ -2,6 +2,6 @@ import pytest
class TestNc:
- @pytest.mark.complete("nc -")
+ @pytest.mark.complete("nc -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_ncftp.py b/test/t/test_ncftp.py
index 470f6a76..b37f48f8 100644
--- a/test/t/test_ncftp.py
+++ b/test/t/test_ncftp.py
@@ -6,6 +6,6 @@ class TestNcftp:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("ncftp -")
+ @pytest.mark.complete("ncftp -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_nethogs.py b/test/t/test_nethogs.py
index a36c587f..c57185fa 100644
--- a/test/t/test_nethogs.py
+++ b/test/t/test_nethogs.py
@@ -5,3 +5,7 @@ class TestNethogs:
@pytest.mark.complete("nethogs ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("nethogs -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_netstat.py b/test/t/test_netstat.py
index 6bcbd4d2..57ef26c0 100644
--- a/test/t/test_netstat.py
+++ b/test/t/test_netstat.py
@@ -5,3 +5,7 @@ class TestNetstat:
@pytest.mark.complete("netstat ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("netstat -", require_longopt=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_newlist.py b/test/t/test_newlist.py
index d51dab26..1d6b439a 100644
--- a/test/t/test_newlist.py
+++ b/test/t/test_newlist.py
@@ -2,6 +2,6 @@ import pytest
class TestNewlist:
- @pytest.mark.complete("newlist -")
+ @pytest.mark.complete("newlist -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_newusers.py b/test/t/test_newusers.py
index acd93ad2..51d746a0 100644
--- a/test/t/test_newusers.py
+++ b/test/t/test_newusers.py
@@ -5,3 +5,7 @@ class TestNewusers:
@pytest.mark.complete("newusers ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("newusers -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_ngrep.py b/test/t/test_ngrep.py
index 0d29abd7..53fa60d0 100644
--- a/test/t/test_ngrep.py
+++ b/test/t/test_ngrep.py
@@ -2,7 +2,7 @@ import pytest
class TestNgrep:
- @pytest.mark.complete("ngrep -")
+ @pytest.mark.complete("ngrep -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_nl.py b/test/t/test_nl.py
index c3e35b42..ca910a59 100644
--- a/test/t/test_nl.py
+++ b/test/t/test_nl.py
@@ -5,3 +5,7 @@ class TestNl:
@pytest.mark.complete("nl ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("nl -", require_longopt=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_nm.py b/test/t/test_nm.py
index 49ff167e..328fa507 100644
--- a/test/t/test_nm.py
+++ b/test/t/test_nm.py
@@ -5,3 +5,7 @@ class TestNm:
@pytest.mark.complete("nm ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("nm -", require_cmd=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_nproc.py b/test/t/test_nproc.py
index 6ab8017c..66a49acb 100644
--- a/test/t/test_nproc.py
+++ b/test/t/test_nproc.py
@@ -6,6 +6,12 @@ class TestNproc:
def test_1(self, completion):
assert not completion
- @pytest.mark.complete("nproc -")
+ @pytest.mark.complete(
+ "nproc --",
+ xfail=(
+ "! nproc --help &>/dev/null || "
+ "! nproc --help 2>&1 | command grep -qF -- --help"
+ ),
+ )
def test_2(self, completion):
assert completion
diff --git a/test/t/test_nsupdate.py b/test/t/test_nsupdate.py
index 5bae9707..b8a133cb 100644
--- a/test/t/test_nsupdate.py
+++ b/test/t/test_nsupdate.py
@@ -6,6 +6,6 @@ class TestNsupdate:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("nsupdate -")
+ @pytest.mark.complete("nsupdate -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_ntpdate.py b/test/t/test_ntpdate.py
index dc1d5b48..c8d65cfd 100644
--- a/test/t/test_ntpdate.py
+++ b/test/t/test_ntpdate.py
@@ -2,6 +2,6 @@ import pytest
class TestNtpdate:
- @pytest.mark.complete("ntpdate -")
+ @pytest.mark.complete("ntpdate -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_objcopy.py b/test/t/test_objcopy.py
index 13a93df5..e3130fab 100644
--- a/test/t/test_objcopy.py
+++ b/test/t/test_objcopy.py
@@ -5,3 +5,7 @@ class TestObjcopy:
@pytest.mark.complete("objcopy ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("objcopy -", require_cmd=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_od.py b/test/t/test_od.py
index a1e648a8..e2f5de28 100644
--- a/test/t/test_od.py
+++ b/test/t/test_od.py
@@ -5,3 +5,7 @@ class TestOd:
@pytest.mark.complete("od ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("od -", require_longopt=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_oggdec.py b/test/t/test_oggdec.py
index 8cabe5cd..395bb866 100644
--- a/test/t/test_oggdec.py
+++ b/test/t/test_oggdec.py
@@ -6,6 +6,6 @@ class TestOggdec:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("oggdec --")
+ @pytest.mark.complete("oggdec --", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_op.py b/test/t/test_op.py
index e09c98c8..662cde5f 100644
--- a/test/t/test_op.py
+++ b/test/t/test_op.py
@@ -2,10 +2,10 @@ import pytest
class TestOp:
- @pytest.mark.complete("op ")
+ @pytest.mark.complete("op ", require_cmd=True)
def test_1(self, completion):
assert completion
- @pytest.mark.complete("op --")
+ @pytest.mark.complete("op --", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_opera.py b/test/t/test_opera.py
index 5ab056f4..f0c657e7 100644
--- a/test/t/test_opera.py
+++ b/test/t/test_opera.py
@@ -5,3 +5,7 @@ class TestOpera:
@pytest.mark.complete("opera ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("opera -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_optipng.py b/test/t/test_optipng.py
index 393b0645..615d71fb 100644
--- a/test/t/test_optipng.py
+++ b/test/t/test_optipng.py
@@ -5,3 +5,7 @@ class TestOptipng:
@pytest.mark.complete("optipng ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("optipng -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_passwd.py b/test/t/test_passwd.py
index 60441de9..f253701b 100644
--- a/test/t/test_passwd.py
+++ b/test/t/test_passwd.py
@@ -6,6 +6,6 @@ class TestPasswd:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("passwd -")
+ @pytest.mark.complete("passwd -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_paste.py b/test/t/test_paste.py
index 2d551322..ecf030b5 100644
--- a/test/t/test_paste.py
+++ b/test/t/test_paste.py
@@ -5,3 +5,7 @@ class TestPaste:
@pytest.mark.complete("paste ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("paste -", require_longopt=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_patch.py b/test/t/test_patch.py
index 455ebd9a..c68a4b65 100644
--- a/test/t/test_patch.py
+++ b/test/t/test_patch.py
@@ -5,3 +5,7 @@ class TestPatch:
@pytest.mark.complete("patch ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("patch -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_pdftotext.py b/test/t/test_pdftotext.py
index 9e332f06..90d001f6 100644
--- a/test/t/test_pdftotext.py
+++ b/test/t/test_pdftotext.py
@@ -5,3 +5,7 @@ class TestPdftotext:
@pytest.mark.complete("pdftotext ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("pdftotext -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_perl.py b/test/t/test_perl.py
index 7c0c6094..c8baa2f3 100644
--- a/test/t/test_perl.py
+++ b/test/t/test_perl.py
@@ -11,33 +11,33 @@ class TestPerl:
def test_2(self, completion):
assert not completion
- @pytest.mark.complete("perl -V:install")
+ @pytest.mark.complete("perl -V:install", require_cmd=True)
def test_3(self, completion):
assert completion
- @pytest.mark.complete("perl -V::install")
+ @pytest.mark.complete("perl -V::install", require_cmd=True)
def test_4(self, completion):
assert completion
# Assume File::Spec and friends are always installed
- @pytest.mark.complete("perl -MFile")
+ @pytest.mark.complete("perl -MFile", require_cmd=True)
def test_5(self, completion):
assert completion
- @pytest.mark.complete("perl -MFile::Sp")
+ @pytest.mark.complete("perl -MFile::Sp", require_cmd=True)
def test_6(self, completion):
assert completion
- @pytest.mark.complete("perl -MFile::Spec::Func")
+ @pytest.mark.complete("perl -MFile::Spec::Func", require_cmd=True)
def test_7(self, completion):
assert completion
- @pytest.mark.complete("perl -M-File")
+ @pytest.mark.complete("perl -M-File", require_cmd=True)
def test_8(self, completion):
assert completion
- @pytest.mark.complete("perl -m-File::")
+ @pytest.mark.complete("perl -m-File::", require_cmd=True)
def test_9(self, completion):
assert completion
@@ -67,13 +67,25 @@ class TestPerl:
@pytest.mark.complete("perl -x shared/default/b")
def test_15(self, completion):
- """-x with space should complete dirs."""
- assert completion == ["shared/default/bar bar.d/"]
+ """-x with space should complete files+dirs."""
+ assert completion == ["bar", "bar bar.d/"]
- @pytest.mark.complete("perl -d:", env=dict(PERL5LIB="$PWD/perl"))
+ @pytest.mark.complete(
+ "perl -d:", env=dict(PERL5LIB="$PWD/perl"), require_cmd=True
+ )
def test_16(self, completion):
assert "BashCompletion" in completion
- @pytest.mark.complete("perl -dt:", env=dict(PERL5LIB="$PWD/perl"))
+ @pytest.mark.complete(
+ "perl -dt:", env=dict(PERL5LIB="$PWD/perl"), require_cmd=True
+ )
def test_17(self, completion):
assert "BashCompletion" in completion
+
+ @pytest.mark.complete("perl -E ")
+ def test_dash_capital_e(self, completion):
+ assert not completion
+
+ @pytest.mark.complete("perl -e")
+ def test_dash_e(self, completion):
+ assert not completion
diff --git a/test/t/test_perlcritic.py b/test/t/test_perlcritic.py
index cc4ef25f..51ba2012 100644
--- a/test/t/test_perlcritic.py
+++ b/test/t/test_perlcritic.py
@@ -6,10 +6,10 @@ class TestPerlcritic:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("perlcritic --")
+ @pytest.mark.complete("perlcritic --", require_cmd=True)
def test_2(self, completion):
assert completion
- @pytest.mark.complete("perlcritic --theme ")
+ @pytest.mark.complete("perlcritic --theme ", require_cmd=True)
def test_3(self, completion):
assert completion
diff --git a/test/t/test_perldoc.py b/test/t/test_perldoc.py
index 9f772944..282f824b 100644
--- a/test/t/test_perldoc.py
+++ b/test/t/test_perldoc.py
@@ -9,7 +9,7 @@ class TestPerldoc:
assert "fixtures/" not in completion # Our fixtures/ dir
assert not [x for x in completion if "File::File::" in x]
- @pytest.mark.complete("perldoc -")
+ @pytest.mark.complete("perldoc -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_perltidy.py b/test/t/test_perltidy.py
index 3bafd6e4..578923af 100644
--- a/test/t/test_perltidy.py
+++ b/test/t/test_perltidy.py
@@ -6,14 +6,14 @@ class TestPerltidy:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("perltidy -h")
+ @pytest.mark.complete("perltidy -h", require_cmd=True)
def test_2(self, completion):
assert completion
- @pytest.mark.complete("perltidy -ole=")
+ @pytest.mark.complete("perltidy -ole=", require_cmd=True)
def test_3(self, completion):
assert completion
- @pytest.mark.complete("perltidy -doesntexist=")
+ @pytest.mark.complete("perltidy -doesntexist=", require_cmd=True)
def test_4(self, completion):
assert not completion
diff --git a/test/t/test_pgrep.py b/test/t/test_pgrep.py
index 1155e582..9c233311 100644
--- a/test/t/test_pgrep.py
+++ b/test/t/test_pgrep.py
@@ -7,3 +7,7 @@ class TestPgrep:
@pytest.mark.complete("pgrep p")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("pgrep -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_phing.py b/test/t/test_phing.py
index 2e8c1069..973a957d 100644
--- a/test/t/test_phing.py
+++ b/test/t/test_phing.py
@@ -2,10 +2,10 @@ import pytest
class TestPhing:
- @pytest.mark.complete("phing -")
+ @pytest.mark.complete("phing -", require_cmd=True)
def test_1(self, completion):
assert completion
- @pytest.mark.complete("phing -l ")
+ @pytest.mark.complete("phing -l ", require_cmd=True)
def test_2(self, completion):
assert not completion
diff --git a/test/t/test_pidof.py b/test/t/test_pidof.py
index fb553e55..c33a4d39 100644
--- a/test/t/test_pidof.py
+++ b/test/t/test_pidof.py
@@ -7,3 +7,9 @@ class TestPidof:
@pytest.mark.complete("pidof p")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete(
+ "pidof -", require_cmd=True, xfail="! pidof --help &>/dev/null"
+ )
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_pine.py b/test/t/test_pine.py
index 2c5549e0..0c95973f 100644
--- a/test/t/test_pine.py
+++ b/test/t/test_pine.py
@@ -2,6 +2,6 @@ import pytest
class TestPine:
- @pytest.mark.complete("pine -")
+ @pytest.mark.complete("pine -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_pinfo.py b/test/t/test_pinfo.py
index b502273f..a22128e3 100644
--- a/test/t/test_pinfo.py
+++ b/test/t/test_pinfo.py
@@ -3,7 +3,7 @@ import pytest
@pytest.mark.bashcomp(pre_cmds=("INFOPATH+=:$PWD/info:",))
class TestPinfo:
- @pytest.mark.complete("pinfo -")
+ @pytest.mark.complete("pinfo -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_ping.py b/test/t/test_ping.py
index e7c77365..f70582a0 100644
--- a/test/t/test_ping.py
+++ b/test/t/test_ping.py
@@ -6,6 +6,6 @@ class TestPing:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("ping -")
+ @pytest.mark.complete("ping -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_pkg_config.py b/test/t/test_pkg_config.py
index a0703e09..81e02cad 100644
--- a/test/t/test_pkg_config.py
+++ b/test/t/test_pkg_config.py
@@ -7,6 +7,6 @@ class TestPkgConfig:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("pkg-config -")
+ @pytest.mark.complete("pkg-config -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_pkgadd.py b/test/t/test_pkgadd.py
index ca6baf27..69d08dcd 100644
--- a/test/t/test_pkgadd.py
+++ b/test/t/test_pkgadd.py
@@ -2,6 +2,7 @@ import pytest
class TestPkgadd:
- @pytest.mark.complete("pkgadd ")
+ # require_cmd is not strictly true here, but...
+ @pytest.mark.complete("pkgadd ", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_pkgrm.py b/test/t/test_pkgrm.py
index 9cb73571..2af81ef9 100644
--- a/test/t/test_pkgrm.py
+++ b/test/t/test_pkgrm.py
@@ -2,6 +2,7 @@ import pytest
class TestPkgrm:
- @pytest.mark.complete("pkgrm ")
+ # require_cmd is not strictly true here, but...
+ @pytest.mark.complete("pkgrm ", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_pkill.py b/test/t/test_pkill.py
index b0af6c3d..a779958b 100644
--- a/test/t/test_pkill.py
+++ b/test/t/test_pkill.py
@@ -5,3 +5,7 @@ class TestPkill:
@pytest.mark.complete("pkill ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("pkill -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_pngfix.py b/test/t/test_pngfix.py
index e27f3293..9b35a398 100644
--- a/test/t/test_pngfix.py
+++ b/test/t/test_pngfix.py
@@ -6,6 +6,6 @@ class TestPngfix:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("pngfix -")
+ @pytest.mark.complete("pngfix -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_portinstall.py b/test/t/test_portinstall.py
index 62fddbfb..eb2118e5 100644
--- a/test/t/test_portinstall.py
+++ b/test/t/test_portinstall.py
@@ -3,10 +3,11 @@ import pytest
from conftest import assert_bash_exec
+@pytest.mark.bashcomp(ignore_env=r"^[+-]PORTSDIR=")
class TestPortinstall:
@pytest.fixture(scope="class")
def portsdir(self, request, bash):
- assert_bash_exec(bash, "PORTSDIR=$TESTDIR/tmp")
+ assert_bash_exec(bash, "PORTSDIR=$PWD/../tmp")
assert_bash_exec(
bash,
"command sed -e s,PORTSDIR,$PORTSDIR,g "
@@ -17,7 +18,7 @@ class TestPortinstall:
lambda: assert_bash_exec(bash, "rm $PORTSDIR/INDEX{,-5}")
)
- @pytest.mark.complete("portinstall ", env=dict(PORTSDIR="$TESTDIR/tmp"))
+ @pytest.mark.complete("portinstall ", env=dict(PORTSDIR="$PWD/../tmp"))
def test_1(self, completion, portsdir):
assert (
completion
diff --git a/test/t/test_portupgrade.py b/test/t/test_portupgrade.py
index aaff5c10..0b46bbf4 100644
--- a/test/t/test_portupgrade.py
+++ b/test/t/test_portupgrade.py
@@ -1,9 +1,8 @@
import pytest
-@pytest.mark.bashcomp(pre_cmds=("PKG_DBDIR=$PWD/dbtools/db",))
+@pytest.mark.bashcomp(pre_cmds=("PKG_DBDIR=$PWD/pkgtools/db",))
class TestPortupgrade:
@pytest.mark.complete("portupgrade ")
def test_1(self, completion):
assert completion == "a b-c-d".split()
- assert completion.endswith(" ")
diff --git a/test/t/test_postcat.py b/test/t/test_postcat.py
index 653cca25..73922e27 100644
--- a/test/t/test_postcat.py
+++ b/test/t/test_postcat.py
@@ -5,3 +5,7 @@ class TestPostcat:
@pytest.mark.complete("postcat ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("postcat -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_postconf.py b/test/t/test_postconf.py
index 641b2734..e0349566 100644
--- a/test/t/test_postconf.py
+++ b/test/t/test_postconf.py
@@ -2,7 +2,7 @@ import pytest
class TestPostconf:
- @pytest.mark.complete("postconf -")
+ @pytest.mark.complete("postconf -", require_cmd=True)
def test_1(self, completion):
assert len(completion) > 1
@@ -13,6 +13,8 @@ class TestPostconf:
# for ::1
# ...and output can be cut off somewhere near lmtp_tls_secur*.
# ...or be completely missing, so all we can do is to skip.
- @pytest.mark.complete("postconf al", skipif="! postconf &>/dev/null")
+ @pytest.mark.complete(
+ "postconf al", require_cmd=True, xfail="! postconf &>/dev/null"
+ )
def test_2(self, completion):
assert completion
diff --git a/test/t/test_postfix.py b/test/t/test_postfix.py
index f7af7b4c..67a898d1 100644
--- a/test/t/test_postfix.py
+++ b/test/t/test_postfix.py
@@ -5,3 +5,8 @@ class TestPostfix:
@pytest.mark.complete("postfix ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.xfail # see TODO in completion
+ @pytest.mark.complete("postfix -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_postmap.py b/test/t/test_postmap.py
index f3430fbd..ee3eee7a 100644
--- a/test/t/test_postmap.py
+++ b/test/t/test_postmap.py
@@ -5,3 +5,7 @@ class TestPostmap:
@pytest.mark.complete("postmap ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("postmap -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_pr.py b/test/t/test_pr.py
index cb023ea0..c790a866 100644
--- a/test/t/test_pr.py
+++ b/test/t/test_pr.py
@@ -5,3 +5,7 @@ class TestPr:
@pytest.mark.complete("pr ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("pr -", require_cmd=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_prelink.py b/test/t/test_prelink.py
index ef8baece..e75b9699 100644
--- a/test/t/test_prelink.py
+++ b/test/t/test_prelink.py
@@ -6,6 +6,6 @@ class TestPrelink:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("prelink -")
+ @pytest.mark.complete("prelink -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_protoc.py b/test/t/test_protoc.py
index 65549d35..e890c56a 100644
--- a/test/t/test_protoc.py
+++ b/test/t/test_protoc.py
@@ -5,3 +5,7 @@ class TestProtoc:
@pytest.mark.complete("protoc ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("protoc -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_psql.py b/test/t/test_psql.py
index 60ed097c..ffd6c058 100644
--- a/test/t/test_psql.py
+++ b/test/t/test_psql.py
@@ -4,6 +4,8 @@ import pytest
class TestPsql:
# --help can fail due to missing package dependencies, e.g. on Ubuntu 14
- @pytest.mark.complete("psql -", skipif="! psql --help &>/dev/null")
+ @pytest.mark.complete(
+ "psql -", require_cmd=True, xfail="! psql --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_ptx.py b/test/t/test_ptx.py
index 2eea63bc..9ddc91c9 100644
--- a/test/t/test_ptx.py
+++ b/test/t/test_ptx.py
@@ -5,3 +5,7 @@ class TestPtx:
@pytest.mark.complete("ptx ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("ptx -", require_cmd=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_pv.py b/test/t/test_pv.py
index ffca68df..ad04c47b 100644
--- a/test/t/test_pv.py
+++ b/test/t/test_pv.py
@@ -6,7 +6,7 @@ class TestPv:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("pv -")
+ @pytest.mark.complete("pv -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_pvchange.py b/test/t/test_pvchange.py
index 78e534ac..4b0a94cb 100644
--- a/test/t/test_pvchange.py
+++ b/test/t/test_pvchange.py
@@ -3,7 +3,7 @@ import pytest
class TestPvchange:
@pytest.mark.complete(
- "pvchange --", skipif="! pvchange --help &>/dev/null"
+ "pvchange --", require_cmd=True, xfail="! pvchange --help &>/dev/null"
)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_pvcreate.py b/test/t/test_pvcreate.py
index 372b9e39..2847c47e 100644
--- a/test/t/test_pvcreate.py
+++ b/test/t/test_pvcreate.py
@@ -3,7 +3,7 @@ import pytest
class TestPvcreate:
@pytest.mark.complete(
- "pvcreate --", skipif="! pvcreate --help &>/dev/null"
+ "pvcreate --", require_cmd=True, xfail="! pvcreate --help &>/dev/null"
)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_pvdisplay.py b/test/t/test_pvdisplay.py
index e5fa07f6..9d1ea83c 100644
--- a/test/t/test_pvdisplay.py
+++ b/test/t/test_pvdisplay.py
@@ -3,7 +3,9 @@ import pytest
class TestPvdisplay:
@pytest.mark.complete(
- "pvdisplay --", skipif="! pvdisplay --help &>/dev/null"
+ "pvdisplay --",
+ require_cmd=True,
+ xfail="! pvdisplay --help &>/dev/null",
)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_pvmove.py b/test/t/test_pvmove.py
index e1b06dd6..e0e2ee89 100644
--- a/test/t/test_pvmove.py
+++ b/test/t/test_pvmove.py
@@ -2,6 +2,8 @@ import pytest
class TestPvmove:
- @pytest.mark.complete("pvmove --")
+ @pytest.mark.complete(
+ "pvmove --", require_cmd=True, xfail="! pvmove --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_pvremove.py b/test/t/test_pvremove.py
index 08bf63b0..c9c031ab 100644
--- a/test/t/test_pvremove.py
+++ b/test/t/test_pvremove.py
@@ -3,7 +3,7 @@ import pytest
class TestPvremove:
@pytest.mark.complete(
- "pvremove --", skipif="! pvremove --help &>/dev/null"
+ "pvremove --", require_cmd=True, xfail="! pvremove --help &>/dev/null"
)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_pvs.py b/test/t/test_pvs.py
index 6063888e..ac173a72 100644
--- a/test/t/test_pvs.py
+++ b/test/t/test_pvs.py
@@ -2,6 +2,8 @@ import pytest
class TestPvs:
- @pytest.mark.complete("pvs --", skipif="! pvs --help &>/dev/null")
+ @pytest.mark.complete(
+ "pvs --", require_cmd=True, xfail="! pvs --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_pvscan.py b/test/t/test_pvscan.py
index 1ae237fc..e2789565 100644
--- a/test/t/test_pvscan.py
+++ b/test/t/test_pvscan.py
@@ -2,6 +2,8 @@ import pytest
class TestPvscan:
- @pytest.mark.complete("pvscan --")
+ @pytest.mark.complete(
+ "pvscan --", require_cmd=True, xfail="! pvscan --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_pwck.py b/test/t/test_pwck.py
index 143c76f1..1e36f87e 100644
--- a/test/t/test_pwck.py
+++ b/test/t/test_pwck.py
@@ -5,3 +5,7 @@ class TestPwck:
@pytest.mark.complete("pwck ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("pwck -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_pwd.py b/test/t/test_pwd.py
index b1ec3378..fe7dd08b 100644
--- a/test/t/test_pwd.py
+++ b/test/t/test_pwd.py
@@ -2,6 +2,6 @@ import pytest
class TestPwd:
- @pytest.mark.complete("pwd -")
+ @pytest.mark.complete("pwd -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_pwdx.py b/test/t/test_pwdx.py
index 411d7a59..552c82c9 100644
--- a/test/t/test_pwdx.py
+++ b/test/t/test_pwdx.py
@@ -5,3 +5,15 @@ class TestPwdx:
@pytest.mark.complete("pwdx ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete(
+ "pwdx -",
+ require_cmd=True,
+ xfail=(
+ "! (pwdx --help 2>&1 || :) | "
+ "command grep -vF 'invalid process id: --help' | "
+ "command grep -q -- '[[:space:]]-'"
+ ),
+ )
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_pwgen.py b/test/t/test_pwgen.py
index 54c194cf..20ecd73b 100644
--- a/test/t/test_pwgen.py
+++ b/test/t/test_pwgen.py
@@ -2,6 +2,6 @@ import pytest
class TestPwgen:
- @pytest.mark.complete("pwgen -")
+ @pytest.mark.complete("pwgen -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_pycodestyle.py b/test/t/test_pycodestyle.py
index 03c58eec..4b4f3a43 100644
--- a/test/t/test_pycodestyle.py
+++ b/test/t/test_pycodestyle.py
@@ -6,7 +6,7 @@ class TestPycodestyle:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("pycodestyle -")
+ @pytest.mark.complete("pycodestyle -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_pydoc.py b/test/t/test_pydoc.py
index e6173676..7cf7eb53 100644
--- a/test/t/test_pydoc.py
+++ b/test/t/test_pydoc.py
@@ -2,6 +2,10 @@ import pytest
class TestPydoc:
- @pytest.mark.complete("pydoc r")
+ @pytest.mark.complete("pydoc r", require_cmd=True)
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("pydoc -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_pydocstyle.py b/test/t/test_pydocstyle.py
index 4deb45fe..caa87902 100644
--- a/test/t/test_pydocstyle.py
+++ b/test/t/test_pydocstyle.py
@@ -6,6 +6,6 @@ class TestPydocstyle:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("pydocstyle -")
+ @pytest.mark.complete("pydocstyle -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_pyflakes.py b/test/t/test_pyflakes.py
index ae3853a7..96703217 100644
--- a/test/t/test_pyflakes.py
+++ b/test/t/test_pyflakes.py
@@ -5,3 +5,7 @@ class TestPyflakes:
@pytest.mark.complete("pyflakes ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("pyflakes -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_pylint.py b/test/t/test_pylint.py
index e08507aa..4b799532 100644
--- a/test/t/test_pylint.py
+++ b/test/t/test_pylint.py
@@ -2,7 +2,7 @@ import pytest
class TestPylint:
- @pytest.mark.complete("pylint --v")
+ @pytest.mark.complete("pylint --v", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_pylint_3.py b/test/t/test_pylint_3.py
index 305db7d3..ee498c32 100644
--- a/test/t/test_pylint_3.py
+++ b/test/t/test_pylint_3.py
@@ -3,7 +3,7 @@ import pytest
@pytest.mark.bashcomp(cmd="pylint-3")
class TestPylint3:
- @pytest.mark.complete("pylint-3 --v")
+ @pytest.mark.complete("pylint-3 --v", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_python.py b/test/t/test_python.py
index 4990f957..57802721 100644
--- a/test/t/test_python.py
+++ b/test/t/test_python.py
@@ -6,7 +6,7 @@ class TestPython:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("python -")
+ @pytest.mark.complete("python -", require_cmd=True)
def test_2(self, completion):
assert len(completion) > 1
@@ -30,6 +30,6 @@ class TestPython:
def test_7(self, completion):
assert not completion
- @pytest.mark.complete("python -m sy")
+ @pytest.mark.complete("python -m sy", require_cmd=True)
def test_8(self, completion):
assert completion
diff --git a/test/t/test_python3.py b/test/t/test_python3.py
index 3f2b5f9e..b968a34e 100644
--- a/test/t/test_python3.py
+++ b/test/t/test_python3.py
@@ -6,7 +6,7 @@ class TestPython3:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("python3 -")
+ @pytest.mark.complete("python3 -", require_cmd=True)
def test_2(self, completion):
assert len(completion) > 1
@@ -30,6 +30,6 @@ class TestPython3:
def test_7(self, completion):
assert not completion
- @pytest.mark.complete("python3 -m sy")
+ @pytest.mark.complete("python3 -m sy", require_cmd=True)
def test_8(self, completion):
assert completion
diff --git a/test/t/test_qemu.py b/test/t/test_qemu.py
index 3be6f64b..129c0b4f 100644
--- a/test/t/test_qemu.py
+++ b/test/t/test_qemu.py
@@ -5,3 +5,7 @@ class TestQemu:
@pytest.mark.complete("qemu ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("qemu -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_querybts.py b/test/t/test_querybts.py
index dd3af4f9..9c81d134 100644
--- a/test/t/test_querybts.py
+++ b/test/t/test_querybts.py
@@ -2,6 +2,6 @@ import pytest
class TestQuerybts:
- @pytest.mark.complete("querybts --")
+ @pytest.mark.complete("querybts --", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_quota.py b/test/t/test_quota.py
index 75098875..c7445355 100644
--- a/test/t/test_quota.py
+++ b/test/t/test_quota.py
@@ -5,3 +5,7 @@ class TestQuota:
@pytest.mark.complete("quota ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("quota -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_quotacheck.py b/test/t/test_quotacheck.py
index 0311befb..81406040 100644
--- a/test/t/test_quotacheck.py
+++ b/test/t/test_quotacheck.py
@@ -2,6 +2,6 @@ import pytest
class TestQuotacheck:
- @pytest.mark.complete("quotacheck -")
+ @pytest.mark.complete("quotacheck -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_quotaon.py b/test/t/test_quotaon.py
index 46bf5546..c4386c6a 100644
--- a/test/t/test_quotaon.py
+++ b/test/t/test_quotaon.py
@@ -2,6 +2,6 @@ import pytest
class TestQuotaon:
- @pytest.mark.complete("quotaon -")
+ @pytest.mark.complete("quotaon -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_radvdump.py b/test/t/test_radvdump.py
index e3d9242d..a8a16d90 100644
--- a/test/t/test_radvdump.py
+++ b/test/t/test_radvdump.py
@@ -2,6 +2,10 @@ import pytest
class TestRadvdump:
- @pytest.mark.complete("radvdump ")
+ @pytest.mark.complete("radvdump ", require_cmd=True)
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("radvdump -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_rdesktop.py b/test/t/test_rdesktop.py
index b82b471e..f20ca518 100644
--- a/test/t/test_rdesktop.py
+++ b/test/t/test_rdesktop.py
@@ -2,6 +2,6 @@ import pytest
class TestRdesktop:
- @pytest.mark.complete("rdesktop -")
+ @pytest.mark.complete("rdesktop -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_rdict.py b/test/t/test_rdict.py
index 86d7c087..da6fb1bb 100644
--- a/test/t/test_rdict.py
+++ b/test/t/test_rdict.py
@@ -2,6 +2,6 @@ import pytest
class TestRdict:
- @pytest.mark.complete("rdict --")
+ @pytest.mark.complete("rdict --", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_readelf.py b/test/t/test_readelf.py
index 5c5dff37..07ce347f 100644
--- a/test/t/test_readelf.py
+++ b/test/t/test_readelf.py
@@ -2,6 +2,6 @@ import pytest
class TestReadelf:
- @pytest.mark.complete("readelf --")
+ @pytest.mark.complete("readelf --", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_repomanage.py b/test/t/test_repomanage.py
index 6def4a8c..bdaba156 100644
--- a/test/t/test_repomanage.py
+++ b/test/t/test_repomanage.py
@@ -5,3 +5,7 @@ class TestRepomanage:
@pytest.mark.complete("repomanage ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("repomanage -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_reportbug.py b/test/t/test_reportbug.py
index 612a96b8..2c57b56d 100644
--- a/test/t/test_reportbug.py
+++ b/test/t/test_reportbug.py
@@ -2,6 +2,6 @@ import pytest
class TestReportbug:
- @pytest.mark.complete("reportbug --m")
+ @pytest.mark.complete("reportbug --m", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_reptyr.py b/test/t/test_reptyr.py
index 62a9b1c5..7c27cb55 100644
--- a/test/t/test_reptyr.py
+++ b/test/t/test_reptyr.py
@@ -6,6 +6,6 @@ class TestReptyr:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("reptyr -")
+ @pytest.mark.complete("reptyr -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_ri.py b/test/t/test_ri.py
index e54f18bb..9430b667 100644
--- a/test/t/test_ri.py
+++ b/test/t/test_ri.py
@@ -3,7 +3,7 @@ import pytest
@pytest.mark.bashcomp(pre_cmds=("export RI='-d ri'",))
class TestRi:
- @pytest.mark.complete("ri -")
+ @pytest.mark.complete("ri -", require_cmd=True)
def test_1(self, completion):
assert completion
@@ -11,6 +11,6 @@ class TestRi:
def test_2(self, completion):
assert completion == "BashCompletion/ cache.ri".split()
- @pytest.mark.complete("ri BashCompletio")
+ @pytest.mark.complete("ri BashCompletio", require_cmd=True)
def test_3(self, completion):
assert completion == "BashCompletion"
diff --git a/test/t/test_rm.py b/test/t/test_rm.py
index 622ef13c..6fda5a1d 100644
--- a/test/t/test_rm.py
+++ b/test/t/test_rm.py
@@ -5,3 +5,7 @@ class TestRm:
@pytest.mark.complete("rm ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("rm -", require_longopt=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_rmdir.py b/test/t/test_rmdir.py
index d416819a..b9816772 100644
--- a/test/t/test_rmdir.py
+++ b/test/t/test_rmdir.py
@@ -10,3 +10,7 @@ class TestRmdir:
def test_2(self, completion):
"""Should complete dirs only, also when invoked using full path."""
assert completion == ["bar bar.d/", "foo.d/"]
+
+ @pytest.mark.complete("rmdir -", require_cmd=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_rmmod.py b/test/t/test_rmmod.py
index dfeb0090..55287059 100644
--- a/test/t/test_rmmod.py
+++ b/test/t/test_rmmod.py
@@ -2,6 +2,6 @@ import pytest
class TestRmmod:
- @pytest.mark.complete("rmmod -")
+ @pytest.mark.complete("rmmod -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_rpm.py b/test/t/test_rpm.py
index 939090dd..e6f71989 100644
--- a/test/t/test_rpm.py
+++ b/test/t/test_rpm.py
@@ -9,3 +9,7 @@ class TestRpm:
@pytest.mark.complete("rpm -q ", skipif='test -z "$(rpm -qa 2>/dev/null)"')
def test_2(self, completion):
assert completion
+
+ @pytest.mark.complete("rpm -", require_cmd=True)
+ def test_3(self, completion):
+ assert completion
diff --git a/test/t/test_rpm2tgz.py b/test/t/test_rpm2tgz.py
index 366faedc..ad6e8bc7 100644
--- a/test/t/test_rpm2tgz.py
+++ b/test/t/test_rpm2tgz.py
@@ -12,9 +12,9 @@ class TestRpm2tgz:
def test_2(self, completion):
expected = sorted(
[
- "%s/"
+ "%s/" % x
for x in os.listdir("slackware/home")
- if os.path.isdir("shared/bin/%s" % x)
+ if os.path.isdir("slackware/home/%s" % x)
]
+ [
x
diff --git a/test/t/test_rpmbuild.py b/test/t/test_rpmbuild.py
index 13f164ba..06c8087d 100644
--- a/test/t/test_rpmbuild.py
+++ b/test/t/test_rpmbuild.py
@@ -2,6 +2,6 @@ import pytest
class TestRpmbuild:
- @pytest.mark.complete("rpmbuild -")
+ @pytest.mark.complete("rpmbuild -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_rtcwake.py b/test/t/test_rtcwake.py
index e9c12d07..19d1dfe3 100644
--- a/test/t/test_rtcwake.py
+++ b/test/t/test_rtcwake.py
@@ -2,6 +2,10 @@ import pytest
class TestRtcwake:
- @pytest.mark.complete("rtcwake ")
+ @pytest.mark.complete("rtcwake ", require_cmd=True)
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("rtcwake -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_sbcl_mt.py b/test/t/test_sbcl_mt.py
index 860acc2f..d8049f3f 100644
--- a/test/t/test_sbcl_mt.py
+++ b/test/t/test_sbcl_mt.py
@@ -3,6 +3,7 @@ import pytest
@pytest.mark.bashcomp(cmd="sbcl-mt")
class TestSbclMt:
+ @pytest.mark.xfail # TODO: whitespace split issue
@pytest.mark.complete("sbcl-mt shared/default/")
def test_1(self, completion):
assert completion == ["bar", "bar bar.d/", "foo", "foo foo.d/"]
diff --git a/test/t/test_sbopkg.py b/test/t/test_sbopkg.py
index cb1f7360..44f15219 100644
--- a/test/t/test_sbopkg.py
+++ b/test/t/test_sbopkg.py
@@ -2,6 +2,6 @@ import pytest
class TestSbopkg:
- @pytest.mark.complete("sbopkg -")
+ @pytest.mark.complete("sbopkg -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_screen.py b/test/t/test_screen.py
index c05e0ce0..d9254bda 100644
--- a/test/t/test_screen.py
+++ b/test/t/test_screen.py
@@ -2,7 +2,7 @@ import pytest
class TestScreen:
- @pytest.mark.complete("screen -")
+ @pytest.mark.complete("screen -", require_cmd=True)
def test_1(self, completion):
assert completion
@@ -22,3 +22,27 @@ class TestScreen:
@pytest.mark.complete("screen -T foo cat")
def test_5(self, completion):
assert completion
+
+ @pytest.mark.complete("screen //")
+ def test_telnet(self, completion):
+ assert completion == "//telnet"
+
+ @pytest.mark.complete("screen cat //")
+ def test_not_telnet(self, completion):
+ assert completion != "//telnet"
+
+ @pytest.mark.complete("screen //telnet ", env=dict(HOME="$PWD/shared"))
+ def test_telnet_first_arg(self, completion):
+ assert "bash-completion-canary-host.local" in completion
+
+ @pytest.mark.complete("screen //telnet foo ", env=dict(HOME="$PWD/shared"))
+ def test_telnet_other_args(self, completion):
+ assert not completion
+
+ @pytest.mark.complete("screen /dev/ttyUSB0 ")
+ def test_serial_2nd_arg(self, completion):
+ assert "19200" in completion
+
+ @pytest.mark.complete("screen /dev/ttyUSB0 9600 ")
+ def test_serial_3rdplus_arg(self, completion):
+ assert not completion
diff --git a/test/t/test_scrub.py b/test/t/test_scrub.py
index 0a521faf..5853ad2b 100644
--- a/test/t/test_scrub.py
+++ b/test/t/test_scrub.py
@@ -6,14 +6,14 @@ class TestScrub:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("scrub -")
+ @pytest.mark.complete("scrub -", require_cmd=True)
def test_2(self, completion):
assert completion
# Not all scrub versions list available patterns in --help output
@pytest.mark.complete(
"scrub -p ",
- skipif="! (scrub --help 2>&1 || :) | " "command grep -q ^Available",
+ xfail="! (scrub --help 2>&1 || :) | command grep -q ^Available",
)
def test_3(self, completion):
assert completion
diff --git a/test/t/test_sed.py b/test/t/test_sed.py
index 3fc0559f..53079c9f 100644
--- a/test/t/test_sed.py
+++ b/test/t/test_sed.py
@@ -2,6 +2,6 @@ import pytest
class TestSed:
- @pytest.mark.complete("sed --", skipif="! sed --help &>/dev/null")
+ @pytest.mark.complete("sed --", require_longopt=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_seq.py b/test/t/test_seq.py
index 96580450..b6722380 100644
--- a/test/t/test_seq.py
+++ b/test/t/test_seq.py
@@ -2,6 +2,6 @@ import pytest
class TestSeq:
- @pytest.mark.complete("seq --")
+ @pytest.mark.complete("seq --", require_longopt=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_setquota.py b/test/t/test_setquota.py
index a2822bca..76fd7b9b 100644
--- a/test/t/test_setquota.py
+++ b/test/t/test_setquota.py
@@ -5,3 +5,7 @@ class TestSetquota:
@pytest.mark.complete("setquota ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("setquota -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_sftp.py b/test/t/test_sftp.py
index e76a6f59..0c039399 100644
--- a/test/t/test_sftp.py
+++ b/test/t/test_sftp.py
@@ -5,3 +5,7 @@ class TestSftp:
@pytest.mark.complete("sftp -Fsp", cwd="sftp")
def test_1(self, completion):
assert completion == "-Fspaced conf"
+
+ @pytest.mark.complete("sftp -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_sha1sum.py b/test/t/test_sha1sum.py
index efe8dfec..e4296d46 100644
--- a/test/t/test_sha1sum.py
+++ b/test/t/test_sha1sum.py
@@ -2,6 +2,6 @@ import pytest
class TestSha1sum:
- @pytest.mark.complete("sha1sum --")
+ @pytest.mark.complete("sha1sum --", require_longopt=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_shar.py b/test/t/test_shar.py
index f73c4b87..5c23004e 100644
--- a/test/t/test_shar.py
+++ b/test/t/test_shar.py
@@ -2,6 +2,6 @@ import pytest
class TestShar:
- @pytest.mark.complete("shar --")
+ @pytest.mark.complete("shar --", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_shellcheck.py b/test/t/test_shellcheck.py
index 54bc4636..703128f1 100644
--- a/test/t/test_shellcheck.py
+++ b/test/t/test_shellcheck.py
@@ -6,14 +6,14 @@ class TestShellcheck:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("shellcheck -")
+ @pytest.mark.complete("shellcheck -", require_cmd=True)
def test_2(self, completion):
assert completion
- @pytest.mark.complete("shellcheck --format=")
+ @pytest.mark.complete("shellcheck --format=", require_cmd=True)
def test_3(self, completion):
assert completion
- @pytest.mark.complete("shellcheck -s ")
+ @pytest.mark.complete("shellcheck -s ", require_cmd=True)
def test_4(self, completion):
assert "bash" in completion
diff --git a/test/t/test_sitecopy.py b/test/t/test_sitecopy.py
index de66a5dc..afdeeaa8 100644
--- a/test/t/test_sitecopy.py
+++ b/test/t/test_sitecopy.py
@@ -2,6 +2,6 @@ import pytest
class TestSitecopy:
- @pytest.mark.complete("sitecopy --")
+ @pytest.mark.complete("sitecopy --", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_slapt_get.py b/test/t/test_slapt_get.py
index 1254d5b4..626dde9e 100644
--- a/test/t/test_slapt_get.py
+++ b/test/t/test_slapt_get.py
@@ -3,11 +3,11 @@ import pytest
@pytest.mark.bashcomp(cmd="slapt-get")
class TestSlaptGet:
- @pytest.mark.complete("slapt-get -")
+ @pytest.mark.complete("slapt-get -", require_cmd=True)
def test_1(self, completion):
assert completion
- @pytest.mark.complete("slapt-get --up")
+ @pytest.mark.complete("slapt-get --up", require_cmd=True)
def test_2(self, completion):
assert completion == "--update --upgrade".split()
diff --git a/test/t/test_slapt_src.py b/test/t/test_slapt_src.py
index df5f4da0..dd443b04 100644
--- a/test/t/test_slapt_src.py
+++ b/test/t/test_slapt_src.py
@@ -3,14 +3,14 @@ import pytest
@pytest.mark.bashcomp(cmd="slapt-src")
class TestSlaptSrc:
- @pytest.mark.complete("slapt-src -")
+ @pytest.mark.complete("slapt-src -", require_cmd=True)
def test_1(self, completion):
assert completion
- @pytest.mark.complete("slapt-src --bu")
+ @pytest.mark.complete("slapt-src --bu", require_cmd=True)
def test_2(self, completion):
assert completion == "--build"
- @pytest.mark.complete("slapt-src --ins")
+ @pytest.mark.complete("slapt-src --ins", require_cmd=True)
def test_3(self, completion):
assert completion == "--install"
diff --git a/test/t/test_smartctl.py b/test/t/test_smartctl.py
index ac6dc68d..26d0147d 100644
--- a/test/t/test_smartctl.py
+++ b/test/t/test_smartctl.py
@@ -2,6 +2,6 @@ import pytest
class TestSmartctl:
- @pytest.mark.complete("smartctl --")
+ @pytest.mark.complete("smartctl --", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_smbcacls.py b/test/t/test_smbcacls.py
index 1ff16e2b..0fe84e30 100644
--- a/test/t/test_smbcacls.py
+++ b/test/t/test_smbcacls.py
@@ -2,6 +2,6 @@ import pytest
class TestSmbcacls:
- @pytest.mark.complete("smbcacls -")
+ @pytest.mark.complete("smbcacls -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_smbclient.py b/test/t/test_smbclient.py
index ed2da4b0..250ab876 100644
--- a/test/t/test_smbclient.py
+++ b/test/t/test_smbclient.py
@@ -2,6 +2,6 @@ import pytest
class TestSmbclient:
- @pytest.mark.complete("smbclient -")
+ @pytest.mark.complete("smbclient -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_smbcquotas.py b/test/t/test_smbcquotas.py
index b7e01d29..16157ed7 100644
--- a/test/t/test_smbcquotas.py
+++ b/test/t/test_smbcquotas.py
@@ -2,6 +2,6 @@ import pytest
class TestSmbcquotas:
- @pytest.mark.complete("smbcquotas -")
+ @pytest.mark.complete("smbcquotas -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_smbget.py b/test/t/test_smbget.py
index a360bd3c..a6df717a 100644
--- a/test/t/test_smbget.py
+++ b/test/t/test_smbget.py
@@ -2,6 +2,6 @@ import pytest
class TestSmbget:
- @pytest.mark.complete("smbget -")
+ @pytest.mark.complete("smbget -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_smbpasswd.py b/test/t/test_smbpasswd.py
index 4d0e76ba..9fae8f26 100644
--- a/test/t/test_smbpasswd.py
+++ b/test/t/test_smbpasswd.py
@@ -2,6 +2,6 @@ import pytest
class TestSmbpasswd:
- @pytest.mark.complete("smbpasswd -")
+ @pytest.mark.complete("smbpasswd -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_smbtar.py b/test/t/test_smbtar.py
index 44b424bc..2a0e01e9 100644
--- a/test/t/test_smbtar.py
+++ b/test/t/test_smbtar.py
@@ -2,6 +2,6 @@ import pytest
class TestSmbtar:
- @pytest.mark.complete("smbtar -")
+ @pytest.mark.complete("smbtar -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_smbtree.py b/test/t/test_smbtree.py
index 0eba4b54..2cb6767e 100644
--- a/test/t/test_smbtree.py
+++ b/test/t/test_smbtree.py
@@ -2,6 +2,6 @@ import pytest
class TestSmbtree:
- @pytest.mark.complete("smbtree -")
+ @pytest.mark.complete("smbtree -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_snownews.py b/test/t/test_snownews.py
index 24ed2dfe..a05df98d 100644
--- a/test/t/test_snownews.py
+++ b/test/t/test_snownews.py
@@ -2,6 +2,6 @@ import pytest
class TestSnownews:
- @pytest.mark.complete("snownews --")
+ @pytest.mark.complete("snownews --", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_sort.py b/test/t/test_sort.py
index 7dbb5b9d..d1a4e369 100644
--- a/test/t/test_sort.py
+++ b/test/t/test_sort.py
@@ -2,6 +2,6 @@ import pytest
class TestSort:
- @pytest.mark.complete("sort --")
+ @pytest.mark.complete("sort --", require_longopt=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_split.py b/test/t/test_split.py
index 79013663..8c3f1f4c 100644
--- a/test/t/test_split.py
+++ b/test/t/test_split.py
@@ -2,6 +2,6 @@ import pytest
class TestSplit:
- @pytest.mark.complete("split --", skipif="! split --help &>/dev/null")
+ @pytest.mark.complete("split --", require_longopt=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_sqlite3.py b/test/t/test_sqlite3.py
index 466281a9..69a13162 100644
--- a/test/t/test_sqlite3.py
+++ b/test/t/test_sqlite3.py
@@ -6,10 +6,10 @@ class TestSqlite3:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("sqlite3 -")
+ @pytest.mark.complete("sqlite3 -", require_cmd=True)
def test_2(self, completion):
assert completion
- @pytest.mark.complete("sqlite3 -scratch foo ")
+ @pytest.mark.complete("sqlite3 -scratch foo ", require_cmd=True)
def test_3(self, completion):
assert not completion
diff --git a/test/t/test_ss.py b/test/t/test_ss.py
index 3e515dde..716c0fd7 100644
--- a/test/t/test_ss.py
+++ b/test/t/test_ss.py
@@ -2,14 +2,14 @@ import pytest
class TestSs:
- @pytest.mark.complete("ss -")
+ @pytest.mark.complete("ss -", require_cmd=True)
def test_1(self, completion):
assert completion
- @pytest.mark.complete("ss -A ")
+ @pytest.mark.complete("ss -A ", require_cmd=True)
def test_2(self, completion):
assert completion
- @pytest.mark.complete("ss -A foo,")
+ @pytest.mark.complete("ss -A foo,", require_cmd=True)
def test_3(self, completion):
assert completion
diff --git a/test/t/test_ssh.py b/test/t/test_ssh.py
index 97a4a733..204b7c7c 100644
--- a/test/t/test_ssh.py
+++ b/test/t/test_ssh.py
@@ -28,3 +28,7 @@ class TestSsh:
@pytest.mark.complete("ssh -vo userknownhostsf")
def test_5(self, completion):
assert "UserKnownHostsFile=" in completion
+
+ @pytest.mark.complete("ssh -", require_cmd=True)
+ def test_6(self, completion):
+ assert completion
diff --git a/test/t/test_ssh_add.py b/test/t/test_ssh_add.py
index 33e679c7..7e493724 100644
--- a/test/t/test_ssh_add.py
+++ b/test/t/test_ssh_add.py
@@ -6,3 +6,12 @@ class TestSshAdd:
@pytest.mark.complete("ssh-add ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete(
+ "ssh-add -",
+ require_cmd=True,
+ xfail="ssh-add --help 2>&1 | "
+ "command grep -qiF 'Could not open a connection'",
+ )
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_ssh_copy_id.py b/test/t/test_ssh_copy_id.py
index cb607715..e38e9014 100644
--- a/test/t/test_ssh_copy_id.py
+++ b/test/t/test_ssh_copy_id.py
@@ -11,6 +11,6 @@ import pytest
ignore_env=r"^[+-]_scp_path_esc=",
)
class TestSshCopyId:
- @pytest.mark.complete("ssh-copy-id -")
+ @pytest.mark.complete("ssh-copy-id -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_ssh_keygen.py b/test/t/test_ssh_keygen.py
index 628672d4..2d53f5f8 100644
--- a/test/t/test_ssh_keygen.py
+++ b/test/t/test_ssh_keygen.py
@@ -3,6 +3,6 @@ import pytest
@pytest.mark.bashcomp(cmd="ssh-keygen")
class TestSshKeygen:
- @pytest.mark.complete("ssh-keygen -")
+ @pytest.mark.complete("ssh-keygen -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_sshmitm.py b/test/t/test_sshmitm.py
index 9964c5b5..671fcf52 100644
--- a/test/t/test_sshmitm.py
+++ b/test/t/test_sshmitm.py
@@ -2,6 +2,6 @@ import pytest
class TestSshmitm:
- @pytest.mark.complete("sshmitm -")
+ @pytest.mark.complete("sshmitm -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_sshow.py b/test/t/test_sshow.py
index b6811e0c..563bc6b4 100644
--- a/test/t/test_sshow.py
+++ b/test/t/test_sshow.py
@@ -2,6 +2,6 @@ import pytest
class TestSshow:
- @pytest.mark.complete("sshow -")
+ @pytest.mark.complete("sshow -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_strace.py b/test/t/test_strace.py
index b9dbfaca..e0d6aedf 100644
--- a/test/t/test_strace.py
+++ b/test/t/test_strace.py
@@ -2,6 +2,6 @@ import pytest
class TestStrace:
- @pytest.mark.complete("strace -")
+ @pytest.mark.complete("strace -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_strings.py b/test/t/test_strings.py
index 3922ecef..6b5d0124 100644
--- a/test/t/test_strings.py
+++ b/test/t/test_strings.py
@@ -5,3 +5,7 @@ class TestStrings:
@pytest.mark.complete("strings ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("strings -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_strip.py b/test/t/test_strip.py
index c756fe03..105012fd 100644
--- a/test/t/test_strip.py
+++ b/test/t/test_strip.py
@@ -2,6 +2,6 @@ import pytest
class TestStrip:
- @pytest.mark.complete("strip --")
+ @pytest.mark.complete("strip --", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_su.py b/test/t/test_su.py
index e6c5ef4b..9aa064dd 100644
--- a/test/t/test_su.py
+++ b/test/t/test_su.py
@@ -5,3 +5,7 @@ class TestSu:
@pytest.mark.complete("su ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("su -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_sudo.py b/test/t/test_sudo.py
index 761c5604..ced6662e 100644
--- a/test/t/test_sudo.py
+++ b/test/t/test_sudo.py
@@ -4,7 +4,7 @@ from conftest import assert_complete
class TestSudo:
- @pytest.mark.complete("sudo -")
+ @pytest.mark.complete("sudo -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_sum.py b/test/t/test_sum.py
new file mode 100644
index 00000000..bfb2cf4e
--- /dev/null
+++ b/test/t/test_sum.py
@@ -0,0 +1,11 @@
+import pytest
+
+
+class TestSum:
+ @pytest.mark.complete("sum ")
+ def test_1(self, completion):
+ assert completion
+
+ @pytest.mark.complete("sum -", require_longopt=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_synclient.py b/test/t/test_synclient.py
index 23138294..8a31a654 100644
--- a/test/t/test_synclient.py
+++ b/test/t/test_synclient.py
@@ -5,10 +5,12 @@ class TestSynclient:
# synclient -l may error out with e.g.
# "Couldn't find synaptics properties. No synaptics driver loaded?"
- @pytest.mark.complete("synclient ", skipif="! synclient -l &>/dev/null")
+ @pytest.mark.complete(
+ "synclient ", require_cmd=True, xfail="! synclient -l &>/dev/null"
+ )
def test_1(self, completion):
assert completion
- @pytest.mark.complete("synclient -")
+ @pytest.mark.complete("synclient -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_sysbench.py b/test/t/test_sysbench.py
index afe21eca..4992d8a6 100644
--- a/test/t/test_sysbench.py
+++ b/test/t/test_sysbench.py
@@ -2,6 +2,10 @@ import pytest
class TestSysbench:
- @pytest.mark.complete("sysbench ")
+ @pytest.mark.complete("sysbench ", require_cmd=True)
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("sysbench -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_sysctl.py b/test/t/test_sysctl.py
index 773b5910..f8db50bd 100644
--- a/test/t/test_sysctl.py
+++ b/test/t/test_sysctl.py
@@ -2,13 +2,14 @@ import pytest
class TestSysctl:
- @pytest.mark.complete("sysctl -")
+ @pytest.mark.complete("sysctl -", require_cmd=True)
def test_1(self, completion):
assert completion
@pytest.mark.complete(
"sysctl kern",
- skipif="! sysctl -N -a 2>/dev/null | " "command grep -q ^kern",
+ require_cmd=True,
+ xfail="! sysctl -N -a 2>/dev/null | command grep -q ^kern",
)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_tac.py b/test/t/test_tac.py
index f612cc90..db433cc9 100644
--- a/test/t/test_tac.py
+++ b/test/t/test_tac.py
@@ -2,6 +2,6 @@ import pytest
class TestTac:
- @pytest.mark.complete("tac --")
+ @pytest.mark.complete("tac --", require_longopt=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_tail.py b/test/t/test_tail.py
index 1b818f7d..6f2b3c61 100644
--- a/test/t/test_tail.py
+++ b/test/t/test_tail.py
@@ -2,6 +2,6 @@ import pytest
class TestTail:
- @pytest.mark.complete("tail --", skipif="! tail --help &>/dev/null")
+ @pytest.mark.complete("tail --", require_longopt=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_tcpdump.py b/test/t/test_tcpdump.py
index ec26187f..a5573640 100644
--- a/test/t/test_tcpdump.py
+++ b/test/t/test_tcpdump.py
@@ -2,6 +2,6 @@ import pytest
class TestTcpdump:
- @pytest.mark.complete("tcpdump -")
+ @pytest.mark.complete("tcpdump -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_tcpnice.py b/test/t/test_tcpnice.py
index c7d208d1..fbe95922 100644
--- a/test/t/test_tcpnice.py
+++ b/test/t/test_tcpnice.py
@@ -2,6 +2,6 @@ import pytest
class TestTcpnice:
- @pytest.mark.complete("tcpnice -")
+ @pytest.mark.complete("tcpnice -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_tee.py b/test/t/test_tee.py
index b0914624..3d8bcd7d 100644
--- a/test/t/test_tee.py
+++ b/test/t/test_tee.py
@@ -5,3 +5,7 @@ class TestTee:
@pytest.mark.complete("tee ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("tee -", require_longopt=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_texindex.py b/test/t/test_texindex.py
index 4a2387ff..c3f6a0b1 100644
--- a/test/t/test_texindex.py
+++ b/test/t/test_texindex.py
@@ -2,6 +2,6 @@ import pytest
class TestTexindex:
- @pytest.mark.complete("texindex --")
+ @pytest.mark.complete("texindex --", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_timeout.py b/test/t/test_timeout.py
index 6b5ac5f0..46fe2e00 100644
--- a/test/t/test_timeout.py
+++ b/test/t/test_timeout.py
@@ -6,6 +6,6 @@ class TestTimeout:
def test_1(self, completion):
assert not completion
- @pytest.mark.complete("timeout -")
+ @pytest.mark.complete("timeout -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_touch.py b/test/t/test_touch.py
index cc398d81..8a49e500 100644
--- a/test/t/test_touch.py
+++ b/test/t/test_touch.py
@@ -2,6 +2,6 @@ import pytest
class TestTouch:
- @pytest.mark.complete("touch --", skipif="! touch --help &>/dev/null")
+ @pytest.mark.complete("touch --", require_longopt=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_tox.py b/test/t/test_tox.py
index b6149362..f012a032 100644
--- a/test/t/test_tox.py
+++ b/test/t/test_tox.py
@@ -6,10 +6,14 @@ class TestTox:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("tox -e ")
+ @pytest.mark.complete("tox -e ", cwd="tox")
def test_2(self, completion):
- assert completion == "ALL"
+ assert all(x in completion for x in "py37 ALL".split())
- @pytest.mark.complete("tox -e foo,")
+ @pytest.mark.complete("tox -e foo,", cwd="tox")
def test_3(self, completion):
- assert completion == "foo,ALL"
+ assert all(x in completion for x in "py37 ALL".split())
+
+ @pytest.mark.complete("tox -e foo -- ", cwd="tox")
+ def test_default_after_dashdash(self, completion):
+ assert "tox.ini" in completion
diff --git a/test/t/test_tr.py b/test/t/test_tr.py
index 84597012..0a51e9e4 100644
--- a/test/t/test_tr.py
+++ b/test/t/test_tr.py
@@ -2,6 +2,6 @@ import pytest
class TestTr:
- @pytest.mark.complete("tr --", skipif="! tr --help &>/dev/null")
+ @pytest.mark.complete("tr --", require_longopt=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_tracepath.py b/test/t/test_tracepath.py
index a6ef7a41..e4cac656 100644
--- a/test/t/test_tracepath.py
+++ b/test/t/test_tracepath.py
@@ -6,6 +6,6 @@ class TestTracepath:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("tracepath -")
+ @pytest.mark.complete("tracepath -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_tshark.py b/test/t/test_tshark.py
index 6505e6a8..8ed881ee 100644
--- a/test/t/test_tshark.py
+++ b/test/t/test_tshark.py
@@ -3,25 +3,25 @@ import pytest
@pytest.mark.bashcomp(ignore_env=r"^\+_tshark_pr(ef|otocol)s=")
class TestTshark:
- @pytest.mark.complete("tshark -")
+ @pytest.mark.complete("tshark -", require_cmd=True)
def test_1(self, completion):
assert completion
- @pytest.mark.complete("tshark -G ")
+ @pytest.mark.complete("tshark -G ", require_cmd=True)
def test_2(self, completion):
assert completion
- @pytest.mark.complete("tshark -O foo,htt")
+ @pytest.mark.complete("tshark -O foo,htt", require_cmd=True)
def test_3(self, completion):
# When there's only one completion, it's be the one with "foo," prefix;
# when multiple (e.g. http and http2), it's the completion alone.
assert completion == "foo,http" or "http" in completion
- @pytest.mark.complete("tshark -o tcp")
+ @pytest.mark.complete("tshark -o tcp", require_cmd=True)
def test_4(self, completion):
assert "tcp.desegment_tcp_streams:" in completion
- @pytest.mark.complete("tshark -otcp")
+ @pytest.mark.complete("tshark -otcp", require_cmd=True)
def test_5(self, completion):
assert "-otcp.desegment_tcp_streams:" in completion
diff --git a/test/t/test_tune2fs.py b/test/t/test_tune2fs.py
index c8f4e873..5cc0e41e 100644
--- a/test/t/test_tune2fs.py
+++ b/test/t/test_tune2fs.py
@@ -5,3 +5,7 @@ class TestTune2fs:
@pytest.mark.complete("tune2fs ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("tune2fs -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_udevadm.py b/test/t/test_udevadm.py
index d5dcddbb..6191c770 100644
--- a/test/t/test_udevadm.py
+++ b/test/t/test_udevadm.py
@@ -2,6 +2,10 @@ import pytest
class TestUdevadm:
- @pytest.mark.complete("udevadm ")
+ @pytest.mark.complete("udevadm ", require_cmd=True)
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("udevadm -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_ulimit.py b/test/t/test_ulimit.py
index 24785beb..3ab974cf 100644
--- a/test/t/test_ulimit.py
+++ b/test/t/test_ulimit.py
@@ -6,7 +6,7 @@ class TestUlimit:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("ulimit -")
+ @pytest.mark.complete("ulimit -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_uname.py b/test/t/test_uname.py
index 743f317c..e71a4334 100644
--- a/test/t/test_uname.py
+++ b/test/t/test_uname.py
@@ -2,6 +2,6 @@ import pytest
class TestUname:
- @pytest.mark.complete("uname --", skipif="! uname --help &>/dev/null")
+ @pytest.mark.complete("uname --", require_longopt=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_unexpand.py b/test/t/test_unexpand.py
index 6b77b3bb..2f1359b4 100644
--- a/test/t/test_unexpand.py
+++ b/test/t/test_unexpand.py
@@ -2,8 +2,6 @@ import pytest
class TestUnexpand:
- @pytest.mark.complete(
- "unexpand --", skipif="! unexpand --help &>/dev/null"
- )
+ @pytest.mark.complete("unexpand --", require_longopt=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_uniq.py b/test/t/test_uniq.py
index 8647c615..73691fd8 100644
--- a/test/t/test_uniq.py
+++ b/test/t/test_uniq.py
@@ -2,6 +2,6 @@ import pytest
class TestUniq:
- @pytest.mark.complete("uniq --", skipif="! uniq --help &>/dev/null")
+ @pytest.mark.complete("uniq --", require_longopt=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_units.py b/test/t/test_units.py
index aa1f89c8..824e2ce4 100644
--- a/test/t/test_units.py
+++ b/test/t/test_units.py
@@ -2,6 +2,8 @@ import pytest
class TestUnits:
- @pytest.mark.complete("units --", skipif="! units --help &>/dev/null")
+ @pytest.mark.complete(
+ "units --", require_cmd=True, xfail="! units --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_unshunt.py b/test/t/test_unshunt.py
index 966312ed..a354239e 100644
--- a/test/t/test_unshunt.py
+++ b/test/t/test_unshunt.py
@@ -2,6 +2,6 @@ import pytest
class TestUnshunt:
- @pytest.mark.complete("unshunt --")
+ @pytest.mark.complete("unshunt --", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_update_alternatives.py b/test/t/test_update_alternatives.py
index 1209bebf..7c777307 100644
--- a/test/t/test_update_alternatives.py
+++ b/test/t/test_update_alternatives.py
@@ -3,6 +3,6 @@ import pytest
@pytest.mark.bashcomp(cmd="update-alternatives")
class TestUpdateAlternatives:
- @pytest.mark.complete("update-alternatives --")
+ @pytest.mark.complete("update-alternatives --", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_upgradepkg.py b/test/t/test_upgradepkg.py
index ada84f1c..4c72a158 100644
--- a/test/t/test_upgradepkg.py
+++ b/test/t/test_upgradepkg.py
@@ -22,12 +22,12 @@ class TestUpgradepkg:
[
"%s/" % x
for x in os.listdir("slackware/home")
- if os.path.isdir("./%s" % x)
+ if os.path.isdir("./slackware/home/%s" % x)
]
+ [
x
for x in os.listdir("slackware/home")
- if os.path.isfile("./%s" % x)
+ if os.path.isfile("./slackware/home/%s" % x)
and fnmatch.fnmatch(x, "*.t[bglx]z")
]
)
diff --git a/test/t/test_urlsnarf.py b/test/t/test_urlsnarf.py
index a9482113..8551c60c 100644
--- a/test/t/test_urlsnarf.py
+++ b/test/t/test_urlsnarf.py
@@ -2,6 +2,6 @@ import pytest
class TestUrlsnarf:
- @pytest.mark.complete("urlsnarf -")
+ @pytest.mark.complete("urlsnarf -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_uscan.py b/test/t/test_uscan.py
index 5f4c684a..142c3250 100644
--- a/test/t/test_uscan.py
+++ b/test/t/test_uscan.py
@@ -2,6 +2,6 @@ import pytest
class TestUscan:
- @pytest.mark.complete("uscan -")
+ @pytest.mark.complete("uscan -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_useradd.py b/test/t/test_useradd.py
index 557d4a91..5cbf6ce4 100644
--- a/test/t/test_useradd.py
+++ b/test/t/test_useradd.py
@@ -6,6 +6,6 @@ class TestUseradd:
def test_1(self, completion):
assert not completion
- @pytest.mark.complete("useradd -")
+ @pytest.mark.complete("useradd -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_userdel.py b/test/t/test_userdel.py
index 74003eb1..718c6629 100644
--- a/test/t/test_userdel.py
+++ b/test/t/test_userdel.py
@@ -2,7 +2,7 @@ import pytest
class TestUserdel:
- @pytest.mark.complete("userdel -")
+ @pytest.mark.complete("userdel -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_usermod.py b/test/t/test_usermod.py
index 1eb169c7..ef3dd5aa 100644
--- a/test/t/test_usermod.py
+++ b/test/t/test_usermod.py
@@ -6,6 +6,6 @@ class TestUsermod:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("usermod -")
+ @pytest.mark.complete("usermod -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_valgrind.py b/test/t/test_valgrind.py
index 2b03d6f9..c7c979dd 100644
--- a/test/t/test_valgrind.py
+++ b/test/t/test_valgrind.py
@@ -10,15 +10,17 @@ class TestValgrind:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("valgrind -")
+ @pytest.mark.complete("valgrind -", require_cmd=True)
def test_2(self, completion):
assert completion
- @pytest.mark.complete("valgrind --tool=memche")
+ @pytest.mark.complete("valgrind --tool=memche", require_cmd=True)
def test_3(self, completion):
assert "--tool=memcheck" in completion
- @pytest.mark.complete("valgrind --tool=helgrind --history-l")
+ @pytest.mark.complete(
+ "valgrind --tool=helgrind --history-l", require_cmd=True
+ )
def test_4(self, completion):
assert "--history-level=" in completion
assert not completion.endswith(" ")
diff --git a/test/t/test_vdir.py b/test/t/test_vdir.py
index 2f6a744e..e1869896 100644
--- a/test/t/test_vdir.py
+++ b/test/t/test_vdir.py
@@ -5,3 +5,7 @@ class TestVdir:
@pytest.mark.complete("vdir ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("vdir -", require_cmd=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_vgcfgbackup.py b/test/t/test_vgcfgbackup.py
index 20ef09cc..2e6c6f1d 100644
--- a/test/t/test_vgcfgbackup.py
+++ b/test/t/test_vgcfgbackup.py
@@ -3,7 +3,9 @@ import pytest
class TestVgcfgbackup:
@pytest.mark.complete(
- "vgcfgbackup -", skipif="! vgcfgbackup --help &>/dev/null"
+ "vgcfgbackup -",
+ require_cmd=True,
+ xfail="! vgcfgbackup --help &>/dev/null",
)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_vgcfgrestore.py b/test/t/test_vgcfgrestore.py
index 26096555..acb1a38f 100644
--- a/test/t/test_vgcfgrestore.py
+++ b/test/t/test_vgcfgrestore.py
@@ -3,7 +3,9 @@ import pytest
class TestVgcfgrestore:
@pytest.mark.complete(
- "vgcfgrestore -", skipif="! vgcfgrestore --help &>/dev/null"
+ "vgcfgrestore -",
+ require_cmd=True,
+ xfail="! vgcfgrestore --help &>/dev/null",
)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_vgchange.py b/test/t/test_vgchange.py
index 0e268bad..ed14f2a7 100644
--- a/test/t/test_vgchange.py
+++ b/test/t/test_vgchange.py
@@ -2,6 +2,8 @@ import pytest
class TestVgchange:
- @pytest.mark.complete("vgchange -")
+ @pytest.mark.complete(
+ "vgchange -", require_cmd=True, xfail="! vgchange --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_vgck.py b/test/t/test_vgck.py
index 347f8f9b..52ddf886 100644
--- a/test/t/test_vgck.py
+++ b/test/t/test_vgck.py
@@ -2,6 +2,8 @@ import pytest
class TestVgck:
- @pytest.mark.complete("vgck -", skipif="! vgck --help &>/dev/null")
+ @pytest.mark.complete(
+ "vgck -", require_cmd=True, xfail="! vgck --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_vgconvert.py b/test/t/test_vgconvert.py
index 9810bc2f..029fe486 100644
--- a/test/t/test_vgconvert.py
+++ b/test/t/test_vgconvert.py
@@ -3,7 +3,7 @@ import pytest
class TestVgconvert:
@pytest.mark.complete(
- "vgconvert -", skipif="! vgconvert --help &>/dev/null"
+ "vgconvert -", require_cmd=True, xfail="! vgconvert --help &>/dev/null"
)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_vgcreate.py b/test/t/test_vgcreate.py
index 07518e58..40c17734 100644
--- a/test/t/test_vgcreate.py
+++ b/test/t/test_vgcreate.py
@@ -2,10 +2,12 @@ import pytest
class TestVgcreate:
- @pytest.mark.complete("vgcreate -")
+ @pytest.mark.complete(
+ "vgcreate -", require_cmd=True, xfail="! vgcreate --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
- @pytest.mark.complete("vgcreate __does_not_exist__")
+ @pytest.mark.complete("vgcreate __does_not_exist__", require_cmd=True)
def test_2(self, completion):
assert not completion
diff --git a/test/t/test_vgdisplay.py b/test/t/test_vgdisplay.py
index a6919a6c..60667292 100644
--- a/test/t/test_vgdisplay.py
+++ b/test/t/test_vgdisplay.py
@@ -3,7 +3,7 @@ import pytest
class TestVgdisplay:
@pytest.mark.complete(
- "vgdisplay -", skipif="! vgdisplay --help &>/dev/null"
+ "vgdisplay -", require_cmd=True, xfail="! vgdisplay --help &>/dev/null"
)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_vgexport.py b/test/t/test_vgexport.py
index ce9a93bf..96ecc3cd 100644
--- a/test/t/test_vgexport.py
+++ b/test/t/test_vgexport.py
@@ -2,6 +2,8 @@ import pytest
class TestVgexport:
- @pytest.mark.complete("vgexport -", skipif="! vgexport --help &>/dev/null")
+ @pytest.mark.complete(
+ "vgexport -", require_cmd=True, xfail="! vgexport --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_vgextend.py b/test/t/test_vgextend.py
index 3d3347f1..8c41ab60 100644
--- a/test/t/test_vgextend.py
+++ b/test/t/test_vgextend.py
@@ -2,6 +2,8 @@ import pytest
class TestVgextend:
- @pytest.mark.complete("vgextend -", skipif="! vgextend --help &>/dev/null")
+ @pytest.mark.complete(
+ "vgextend -", require_cmd=True, xfail="! vgextend --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_vgimport.py b/test/t/test_vgimport.py
index 1a3efab0..24017d2b 100644
--- a/test/t/test_vgimport.py
+++ b/test/t/test_vgimport.py
@@ -2,6 +2,8 @@ import pytest
class TestVgimport:
- @pytest.mark.complete("vgimport -", skipif="! vgimport --help &>/dev/null")
+ @pytest.mark.complete(
+ "vgimport -", require_cmd=True, xfail="! vgimport --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_vgmerge.py b/test/t/test_vgmerge.py
index 971eb69a..7d889321 100644
--- a/test/t/test_vgmerge.py
+++ b/test/t/test_vgmerge.py
@@ -2,6 +2,8 @@ import pytest
class TestVgmerge:
- @pytest.mark.complete("vgmerge -", skipif="! vgmerge --help &>/dev/null")
+ @pytest.mark.complete(
+ "vgmerge -", require_cmd=True, xfail="! vgmerge --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_vgmknodes.py b/test/t/test_vgmknodes.py
index 3209de9f..7e046f05 100644
--- a/test/t/test_vgmknodes.py
+++ b/test/t/test_vgmknodes.py
@@ -3,7 +3,7 @@ import pytest
class TestVgmknodes:
@pytest.mark.complete(
- "vgmknodes -", skipif="! vgmknodes --help &>/dev/null"
+ "vgmknodes -", require_cmd=True, xfail="! vgmknodes --help &>/dev/null"
)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_vgreduce.py b/test/t/test_vgreduce.py
index 97641b42..26174b95 100644
--- a/test/t/test_vgreduce.py
+++ b/test/t/test_vgreduce.py
@@ -2,6 +2,8 @@ import pytest
class TestVgreduce:
- @pytest.mark.complete("vgreduce -", skipif="! vgreduce --help &>/dev/null")
+ @pytest.mark.complete(
+ "vgreduce -", require_cmd=True, xfail="! vgreduce --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_vgremove.py b/test/t/test_vgremove.py
index 9c47752c..637d5c3f 100644
--- a/test/t/test_vgremove.py
+++ b/test/t/test_vgremove.py
@@ -2,6 +2,8 @@ import pytest
class TestVgremove:
- @pytest.mark.complete("vgremove -", skipif="! vgremove --help &>/dev/null")
+ @pytest.mark.complete(
+ "vgremove -", require_cmd=True, xfail="! vgremove --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_vgrename.py b/test/t/test_vgrename.py
index ea5bc050..87a6a727 100644
--- a/test/t/test_vgrename.py
+++ b/test/t/test_vgrename.py
@@ -2,6 +2,8 @@ import pytest
class TestVgrename:
- @pytest.mark.complete("vgrename -", skipif="! vgrename --help &>/dev/null")
+ @pytest.mark.complete(
+ "vgrename -", require_cmd=True, xfail="! vgrename --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_vgs.py b/test/t/test_vgs.py
index d492fe8d..e0d8a033 100644
--- a/test/t/test_vgs.py
+++ b/test/t/test_vgs.py
@@ -2,6 +2,8 @@ import pytest
class TestVgs:
- @pytest.mark.complete("vgs -", skipif="! vgs --help &>/dev/null")
+ @pytest.mark.complete(
+ "vgs -", require_cmd=True, xfail="! vgs --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_vgscan.py b/test/t/test_vgscan.py
index 061ff4e2..95a4026c 100644
--- a/test/t/test_vgscan.py
+++ b/test/t/test_vgscan.py
@@ -2,6 +2,8 @@ import pytest
class TestVgscan:
- @pytest.mark.complete("vgscan -", skipif="! vgscan --help &>/dev/null")
+ @pytest.mark.complete(
+ "vgscan -", require_cmd=True, xfail="! vgscan --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_vgsplit.py b/test/t/test_vgsplit.py
index 7b5a6869..1c3dfa85 100644
--- a/test/t/test_vgsplit.py
+++ b/test/t/test_vgsplit.py
@@ -2,6 +2,8 @@ import pytest
class TestVgsplit:
- @pytest.mark.complete("vgsplit -")
+ @pytest.mark.complete(
+ "vgsplit -", require_cmd=True, xfail="! vgsplit --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_vipw.py b/test/t/test_vipw.py
index 160cb11b..07b454bf 100644
--- a/test/t/test_vipw.py
+++ b/test/t/test_vipw.py
@@ -2,6 +2,6 @@ import pytest
class TestVipw:
- @pytest.mark.complete("vipw -")
+ @pytest.mark.complete("vipw -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_vmstat.py b/test/t/test_vmstat.py
index 47b55f6f..b7145ff3 100644
--- a/test/t/test_vmstat.py
+++ b/test/t/test_vmstat.py
@@ -2,6 +2,6 @@ import pytest
class TestVmstat:
- @pytest.mark.complete("vmstat -")
+ @pytest.mark.complete("vmstat -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_vpnc.py b/test/t/test_vpnc.py
index 29a120a4..dac5b15b 100644
--- a/test/t/test_vpnc.py
+++ b/test/t/test_vpnc.py
@@ -8,6 +8,6 @@ import pytest
pre_cmds=("PATH=/usr/sbin:$PATH",)
)
class TestVpnc:
- @pytest.mark.complete("vpnc -")
+ @pytest.mark.complete("vpnc -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_watch.py b/test/t/test_watch.py
index 8387ae0a..b1de7f55 100644
--- a/test/t/test_watch.py
+++ b/test/t/test_watch.py
@@ -2,6 +2,6 @@ import pytest
class TestWatch:
- @pytest.mark.complete("watch -")
+ @pytest.mark.complete("watch -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_wc.py b/test/t/test_wc.py
index eb7b5a85..1f83ea7f 100644
--- a/test/t/test_wc.py
+++ b/test/t/test_wc.py
@@ -2,6 +2,6 @@ import pytest
class TestWc:
- @pytest.mark.complete("wc --", skipif="! wc --help &>/dev/null")
+ @pytest.mark.complete("wc --", require_longopt=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_webmitm.py b/test/t/test_webmitm.py
index e9f85940..d631dcf0 100644
--- a/test/t/test_webmitm.py
+++ b/test/t/test_webmitm.py
@@ -2,6 +2,6 @@ import pytest
class TestWebmitm:
- @pytest.mark.complete("webmitm -")
+ @pytest.mark.complete("webmitm -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_wget.py b/test/t/test_wget.py
index f8af4fb3..de752c26 100644
--- a/test/t/test_wget.py
+++ b/test/t/test_wget.py
@@ -6,6 +6,6 @@ class TestWget:
def test_1(self, completion):
assert not completion
- @pytest.mark.complete("wget --h")
+ @pytest.mark.complete("wget --s", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_who.py b/test/t/test_who.py
index d1f29ea7..9131ac76 100644
--- a/test/t/test_who.py
+++ b/test/t/test_who.py
@@ -2,6 +2,8 @@ import pytest
class TestWho:
- @pytest.mark.complete("who --", skipif="! who --help &>/dev/null")
+ @pytest.mark.complete(
+ "who --", require_cmd=True, xfail="! who --help &>/dev/null"
+ )
def test_1(self, completion):
assert completion
diff --git a/test/t/test_wol.py b/test/t/test_wol.py
index 8a6bea21..b7a622ee 100644
--- a/test/t/test_wol.py
+++ b/test/t/test_wol.py
@@ -13,3 +13,7 @@ class TestWol:
@pytest.mark.complete("wol 00:")
def test_2(self, completion):
assert completion == "00:00:00:00:00:00"
+
+ @pytest.mark.complete("wol -", require_cmd=True)
+ def test_3(self, completion):
+ assert completion
diff --git a/test/t/test_wsimport.py b/test/t/test_wsimport.py
index b75bf0f7..8c27f4bd 100644
--- a/test/t/test_wsimport.py
+++ b/test/t/test_wsimport.py
@@ -5,3 +5,14 @@ class TestWsimport:
@pytest.mark.complete("wsimport ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete(
+ "wsimport -",
+ require_cmd=True,
+ xfail=(
+ "! (wsimport -help 2>&1 || :) | "
+ "command grep -q -- '[[:space:]]-'"
+ ),
+ )
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_wtf.py b/test/t/test_wtf.py
index 6b2c9745..45dfcfd2 100644
--- a/test/t/test_wtf.py
+++ b/test/t/test_wtf.py
@@ -2,6 +2,7 @@ import pytest
class TestWtf:
- @pytest.mark.complete("wtf A")
+ # TODO: actually requires an acronym db, not the cmd
+ @pytest.mark.complete("wtf A", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_wvdial.py b/test/t/test_wvdial.py
index 19043f61..bbc520de 100644
--- a/test/t/test_wvdial.py
+++ b/test/t/test_wvdial.py
@@ -2,6 +2,6 @@ import pytest
class TestWvdial:
- @pytest.mark.complete("wvdial -")
+ @pytest.mark.complete("wvdial -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_xdg_settings.py b/test/t/test_xdg_settings.py
index a50df579..1a194592 100644
--- a/test/t/test_xdg_settings.py
+++ b/test/t/test_xdg_settings.py
@@ -7,10 +7,10 @@ class TestXdgSettings:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("xdg-settings --")
+ @pytest.mark.complete("xdg-settings --", require_cmd=True)
def test_2(self, completion):
assert completion
- @pytest.mark.complete("xdg-settings get ")
+ @pytest.mark.complete("xdg-settings get ", require_cmd=True)
def test_3(self, completion):
assert completion
diff --git a/test/t/test_xfreerdp.py b/test/t/test_xfreerdp.py
index fdad1926..a8435d6c 100644
--- a/test/t/test_xfreerdp.py
+++ b/test/t/test_xfreerdp.py
@@ -17,30 +17,30 @@ class TestXfreerdp:
if "/help" in self._help(bash):
pytest.skip("Not dash syntax")
- @pytest.mark.complete("xfreerdp /")
+ @pytest.mark.complete("xfreerdp /", require_cmd=True)
def test_1(self, bash, completion, slash_syntax):
assert completion
- @pytest.mark.complete("xfreerdp -")
+ @pytest.mark.complete("xfreerdp -", require_cmd=True)
def test_2(self, completion):
assert completion
- @pytest.mark.complete("xfreerdp +")
+ @pytest.mark.complete("xfreerdp +", require_cmd=True)
def test_3(self, bash, completion, slash_syntax):
assert completion
- @pytest.mark.complete("xfreerdp /kbd:")
+ @pytest.mark.complete("xfreerdp /kbd:", require_cmd=True)
def test_4(self, bash, completion, slash_syntax):
assert completion
- @pytest.mark.complete("xfreerdp /help ")
+ @pytest.mark.complete("xfreerdp /help ", require_cmd=True)
def test_5(self, completion):
assert not completion
- @pytest.mark.complete("xfreerdp -k ")
+ @pytest.mark.complete("xfreerdp -k ", require_cmd=True)
def test_6(self, bash, completion, dash_syntax):
assert completion
- @pytest.mark.complete("xfreerdp --help ")
+ @pytest.mark.complete("xfreerdp --help ", require_cmd=True)
def test_7(self, completion):
assert not completion
diff --git a/test/t/test_xgamma.py b/test/t/test_xgamma.py
index 56c9440d..beb684f8 100644
--- a/test/t/test_xgamma.py
+++ b/test/t/test_xgamma.py
@@ -2,11 +2,11 @@ import pytest
class TestXgamma:
- @pytest.mark.complete("xgamma -")
+ @pytest.mark.complete("xgamma -", require_cmd=True)
def test_1(self, completion):
assert completion
- @pytest.mark.complete("xgamma -gam")
+ @pytest.mark.complete("xgamma -gam", require_cmd=True)
def test_2(self, completion):
assert completion == "-gamma"
assert completion.endswith(" ")
diff --git a/test/t/test_xmllint.py b/test/t/test_xmllint.py
index 0c0ebbcd..21c52c7c 100644
--- a/test/t/test_xmllint.py
+++ b/test/t/test_xmllint.py
@@ -6,6 +6,6 @@ class TestXmllint:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("xmllint -")
+ @pytest.mark.complete("xmllint -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_xmlwf.py b/test/t/test_xmlwf.py
index 8751f865..901f78af 100644
--- a/test/t/test_xmlwf.py
+++ b/test/t/test_xmlwf.py
@@ -5,3 +5,7 @@ class TestXmlwf:
@pytest.mark.complete("xmlwf ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("xmlwf -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_xmms.py b/test/t/test_xmms.py
index 1c96e2b5..a880b166 100644
--- a/test/t/test_xmms.py
+++ b/test/t/test_xmms.py
@@ -2,7 +2,7 @@ import pytest
class TestXmms:
- @pytest.mark.complete("xmms --")
+ @pytest.mark.complete("xmms --", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_xmodmap.py b/test/t/test_xmodmap.py
index d6d0ceae..cc33d737 100644
--- a/test/t/test_xmodmap.py
+++ b/test/t/test_xmodmap.py
@@ -6,6 +6,6 @@ class TestXmodmap:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("xmodmap -")
+ @pytest.mark.complete("xmodmap -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_xrandr.py b/test/t/test_xrandr.py
index e4e0d6b7..e7669224 100644
--- a/test/t/test_xrandr.py
+++ b/test/t/test_xrandr.py
@@ -2,10 +2,14 @@ import pytest
class TestXrandr:
- @pytest.mark.complete("xrandr ")
+ @pytest.mark.complete("xrandr ", require_cmd=True)
def test_1(self, completion):
assert completion
@pytest.mark.complete("xrandr --mode ")
def test_2(self, completion):
assert not completion
+
+ @pytest.mark.complete("xrandr -", require_cmd=True)
+ def test_3(self, completion):
+ assert completion
diff --git a/test/t/test_xrdb.py b/test/t/test_xrdb.py
index 8f675e68..3ffce2c5 100644
--- a/test/t/test_xrdb.py
+++ b/test/t/test_xrdb.py
@@ -5,3 +5,7 @@ class TestXrdb:
@pytest.mark.complete("xrdb ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("xrdb -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_xsltproc.py b/test/t/test_xsltproc.py
index 26898777..259f9eb9 100644
--- a/test/t/test_xsltproc.py
+++ b/test/t/test_xsltproc.py
@@ -6,6 +6,6 @@ class TestXsltproc:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("xsltproc -")
+ @pytest.mark.complete("xsltproc -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_xvfb_run.py b/test/t/test_xvfb_run.py
new file mode 100644
index 00000000..89eb8308
--- /dev/null
+++ b/test/t/test_xvfb_run.py
@@ -0,0 +1,12 @@
+import pytest
+
+
+@pytest.mark.bashcomp(cmd="xvfb-run")
+class TestXvfbRun:
+ @pytest.mark.complete("xvfb-run ")
+ def test_no_args(self, completion):
+ assert any(x in completion for x in ("bash", "xvfb-run"))
+
+ @pytest.mark.complete("xvfb-run -", require_cmd=True)
+ def test_options(self, completion):
+ assert completion
diff --git a/test/t/test_xxd.py b/test/t/test_xxd.py
index bd461eb7..9e84bb7c 100644
--- a/test/t/test_xxd.py
+++ b/test/t/test_xxd.py
@@ -6,6 +6,6 @@ class TestXxd:
def test_1(self, completion):
assert completion
- @pytest.mark.complete("xxd -")
+ @pytest.mark.complete("xxd -", require_cmd=True)
def test_2(self, completion):
assert completion
diff --git a/test/t/test_xz.py b/test/t/test_xz.py
index 6b92f480..f226d02b 100644
--- a/test/t/test_xz.py
+++ b/test/t/test_xz.py
@@ -20,3 +20,7 @@ class TestXz:
@pytest.mark.complete("xz ~")
def test_4(self, completion):
assert completion
+
+ @pytest.mark.complete("xz -", require_cmd=True)
+ def test_5(self, completion):
+ assert completion
diff --git a/test/t/test_xzdec.py b/test/t/test_xzdec.py
index e57c1b65..a1e9a3ba 100644
--- a/test/t/test_xzdec.py
+++ b/test/t/test_xzdec.py
@@ -5,3 +5,7 @@ class TestXzdec:
@pytest.mark.complete("xzdec ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("xzdec -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/test_ypcat.py b/test/t/test_ypcat.py
index f743c5ad..0fc4b458 100644
--- a/test/t/test_ypcat.py
+++ b/test/t/test_ypcat.py
@@ -2,6 +2,6 @@ import pytest
class TestYpcat:
- @pytest.mark.complete("ypcat ")
+ @pytest.mark.complete("ypcat ", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_ypmatch.py b/test/t/test_ypmatch.py
index db56320a..18331aa7 100644
--- a/test/t/test_ypmatch.py
+++ b/test/t/test_ypmatch.py
@@ -2,6 +2,7 @@ import pytest
class TestYpmatch:
- @pytest.mark.complete("ypmatch foo ")
+ # Actually requires ypcat
+ @pytest.mark.complete("ypmatch foo ", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_yum.py b/test/t/test_yum.py
index 5d4a052b..5dd1ebac 100644
--- a/test/t/test_yum.py
+++ b/test/t/test_yum.py
@@ -2,6 +2,6 @@ import pytest
class TestYum:
- @pytest.mark.complete("yum -")
+ @pytest.mark.complete("yum -", require_cmd=True)
def test_1(self, completion):
assert completion
diff --git a/test/t/test_zopfli.py b/test/t/test_zopfli.py
index 127eda28..e5a71b3c 100644
--- a/test/t/test_zopfli.py
+++ b/test/t/test_zopfli.py
@@ -9,3 +9,7 @@ class TestZopfli:
@pytest.mark.complete("zopfli ~")
def test_2(self, completion):
assert completion
+
+ @pytest.mark.complete("zopfli -", require_cmd=True)
+ def test_3(self, completion):
+ assert completion
diff --git a/test/t/test_zopflipng.py b/test/t/test_zopflipng.py
index a01e7bd7..3ff120ff 100644
--- a/test/t/test_zopflipng.py
+++ b/test/t/test_zopflipng.py
@@ -5,3 +5,7 @@ class TestZopflipng:
@pytest.mark.complete("zopflipng ")
def test_1(self, completion):
assert completion
+
+ @pytest.mark.complete("zopflipng -", require_cmd=True)
+ def test_2(self, completion):
+ assert completion
diff --git a/test/t/unit/Makefile.am b/test/t/unit/Makefile.am
index a0ab7502..b96b326c 100644
--- a/test/t/unit/Makefile.am
+++ b/test/t/unit/Makefile.am
@@ -11,7 +11,9 @@ EXTRA_DIST = \
test_unit_longopt.py \
test_unit_parse_help.py \
test_unit_parse_usage.py \
- test_unit_tilde.py
+ test_unit_quote.py \
+ test_unit_tilde.py \
+ test_unit_variables.py
all:
diff --git a/test/t/unit/test_unit_filedir.py b/test/t/unit/test_unit_filedir.py
index dcd52403..7f14f294 100644
--- a/test/t/unit/test_unit_filedir.py
+++ b/test/t/unit/test_unit_filedir.py
@@ -1,9 +1,125 @@
import pytest
-from conftest import assert_bash_exec
+from conftest import assert_bash_exec, assert_complete
@pytest.mark.bashcomp(cmd=None, ignore_env=r"^\+COMPREPLY=")
class TestUnitFiledir:
+ @pytest.fixture(scope="class")
+ def functions(self, request, bash):
+ assert_bash_exec(
+ bash,
+ "_f() { local cur=$(_get_cword); unset COMPREPLY; _filedir; }; "
+ "complete -F _f f; "
+ "complete -F _f -o filenames f2",
+ )
+ assert_bash_exec(
+ bash,
+ "_g() { local cur=$(_get_cword); unset COMPREPLY; _filedir e1; }; "
+ "complete -F _g g",
+ )
+ assert_bash_exec(
+ bash,
+ "_fd() { local cur=$(_get_cword); unset COMPREPLY; _filedir -d; };"
+ "complete -F _fd fd",
+ )
+
def test_1(self, bash):
assert_bash_exec(bash, "_filedir >/dev/null")
+
+ @pytest.mark.parametrize("funcname", "f f2".split())
+ def test_2(self, bash, functions, funcname):
+ completion = assert_complete(bash, "%s ab/" % funcname, cwd="_filedir")
+ assert completion == "ab/e"
+
+ @pytest.mark.parametrize("funcname", "f f2".split())
+ def test_3(self, bash, functions, funcname):
+ completion = assert_complete(
+ bash, r"%s a\ b/" % funcname, cwd="_filedir"
+ )
+ assert completion == "a b/i"
+
+ @pytest.mark.parametrize("funcname", "f f2".split())
+ def test_4(self, bash, functions, funcname):
+ completion = assert_complete(
+ bash, r"%s a\'b/" % funcname, cwd="_filedir"
+ )
+ assert completion == "a'b/c"
+
+ @pytest.mark.parametrize("funcname", "f f2".split())
+ def test_5(self, bash, functions, funcname):
+ completion = assert_complete(
+ bash, r"%s a\&b/" % funcname, cwd="_filedir"
+ )
+ assert completion == "a&b/f"
+
+ @pytest.mark.parametrize("funcname", "f f2".split())
+ def test_6(self, bash, functions, funcname):
+ completion = assert_complete(
+ bash, r"%s a\$" % funcname, cwd="_filedir"
+ )
+ assert completion == "a$b/"
+
+ @pytest.mark.parametrize("funcname", "f f2".split())
+ def test_7(self, bash, functions, funcname):
+ completion = assert_complete(
+ bash, r"%s 'ab/" % funcname, cwd="_filedir"
+ )
+ assert completion == "ab/e"
+
+ @pytest.mark.parametrize("funcname", "f f2".split())
+ def test_8(self, bash, functions, funcname):
+ completion = assert_complete(
+ bash, r"%s 'a b/" % funcname, cwd="_filedir"
+ )
+ assert completion == "a b/i"
+
+ @pytest.mark.parametrize("funcname", "f f2".split())
+ def test_9(self, bash, functions, funcname):
+ completion = assert_complete(
+ bash, r"%s 'a$b/" % funcname, cwd="_filedir"
+ )
+ assert completion == "a$b/h"
+
+ @pytest.mark.parametrize("funcname", "f f2".split())
+ def test_10(self, bash, functions, funcname):
+ completion = assert_complete(
+ bash, r"%s 'a&b/" % funcname, cwd="_filedir"
+ )
+ assert completion == "a&b/f"
+
+ @pytest.mark.parametrize("funcname", "f f2".split())
+ def test_11(self, bash, functions, funcname):
+ completion = assert_complete(
+ bash, r'%s "ab/' % funcname, cwd="_filedir"
+ )
+ assert completion == "ab/e"
+
+ @pytest.mark.parametrize("funcname", "f f2".split())
+ def test_12(self, bash, functions, funcname):
+ completion = assert_complete(
+ bash, r'%s "a b/' % funcname, cwd="_filedir"
+ )
+ assert completion == "a b/i"
+
+ @pytest.mark.parametrize("funcname", "f f2".split())
+ def test_13(self, bash, functions, funcname):
+ completion = assert_complete(
+ bash, "%s \"a'b/" % funcname, cwd="_filedir"
+ )
+ assert completion == "a'b/c"
+
+ @pytest.mark.parametrize("funcname", "f f2".split())
+ def test_14(self, bash, functions, funcname):
+ completion = assert_complete(
+ bash, '%s "a&b/' % funcname, cwd="_filedir"
+ )
+ assert completion == "a&b/f"
+
+ @pytest.mark.complete(r"fd a\ ", cwd="_filedir")
+ def test_15(self, functions, completion):
+ assert completion == "a b/"
+
+ @pytest.mark.complete("g ", cwd="_filedir/ext")
+ def test_16(self, functions, completion):
+ assert completion == sorted("ee.e1 foo/ gg.e1 ii.E1".split())
diff --git a/test/t/unit/test_unit_ip_addresses.py b/test/t/unit/test_unit_ip_addresses.py
index cd7a38ab..8120c882 100644
--- a/test/t/unit/test_unit_ip_addresses.py
+++ b/test/t/unit/test_unit_ip_addresses.py
@@ -1,6 +1,6 @@
import pytest
-from conftest import assert_bash_exec, in_docker
+from conftest import assert_bash_exec, in_container
@pytest.mark.bashcomp(cmd=None, ignore_env=r"^\+COMPREPLY=")
@@ -41,7 +41,7 @@ class TestUnitIpAddresses:
assert completion
assert all("." in x for x in completion)
- @pytest.mark.xfail(in_docker(), reason="Probably fails in docker")
+ @pytest.mark.xfail(in_container(), reason="Probably fails in a container")
@pytest.mark.complete("ia6 ")
def test_4(self, functions, completion):
"""_ip_addresses -6 should complete ipv6 addresses."""
diff --git a/test/t/unit/test_unit_quote.py b/test/t/unit/test_unit_quote.py
new file mode 100644
index 00000000..e9f81c2d
--- /dev/null
+++ b/test/t/unit/test_unit_quote.py
@@ -0,0 +1,36 @@
+import pytest
+
+from conftest import assert_bash_exec, TestUnitBase
+
+
+@pytest.mark.bashcomp(cmd=None)
+class TestUnitQuote(TestUnitBase):
+ def test_1(self, bash):
+ output = assert_bash_exec(
+ bash, 'quote "a b"', want_output=True, want_newline=False
+ )
+ assert output.strip() == "'a b'"
+
+ def test_2(self, bash):
+ output = assert_bash_exec(
+ bash, 'quote "a b"', want_output=True, want_newline=False
+ )
+ assert output.strip() == "'a b'"
+
+ def test_3(self, bash):
+ output = assert_bash_exec(
+ bash, 'quote " a "', want_output=True, want_newline=False
+ )
+ assert output.strip() == "' a '"
+
+ def test_4(self, bash):
+ output = assert_bash_exec(
+ bash, "quote \"a'b'c\"", want_output=True, want_newline=False
+ )
+ assert output.strip() == r"'a'\''b'\''c'"
+
+ def test_5(self, bash):
+ output = assert_bash_exec(
+ bash, 'quote "a\'"', want_output=True, want_newline=False
+ )
+ assert output.strip() == r"'a'\'''"
diff --git a/test/t/unit/test_unit_variables.py b/test/t/unit/test_unit_variables.py
new file mode 100644
index 00000000..dd7a4219
--- /dev/null
+++ b/test/t/unit/test_unit_variables.py
@@ -0,0 +1,41 @@
+import pytest
+
+from conftest import assert_bash_exec
+
+
+@pytest.mark.bashcomp(cmd=None, ignore_env=r"^[+-](___var|assoc[12])=")
+class TestUnitVariables:
+ @pytest.fixture(scope="class")
+ def functions(self, request, bash):
+ assert_bash_exec(bash, "unset assoc1 && declare -A assoc1=([idx]=1)")
+ assert_bash_exec(
+ bash, "unset assoc2 && declare -A assoc2=([idx1]=1 [idx2]=2)"
+ )
+ assert_bash_exec(bash, "unset ${!___v*} && declare ___var=''")
+ request.addfinalizer(
+ lambda: assert_bash_exec(bash, "unset ___var assoc1 assoc2")
+ )
+
+ @pytest.mark.complete(": $___v")
+ def test_simple_variable_name(self, functions, completion):
+ assert completion == "$___var".split()
+
+ @pytest.mark.complete(": ${assoc1[")
+ def test_single_array_index(self, functions, completion):
+ assert completion == "${assoc1[idx]}".split()
+
+ @pytest.mark.complete(": ${assoc2[")
+ def test_multiple_array_indexes(self, functions, completion):
+ assert completion == "${assoc2[idx1]} ${assoc2[idx2]}".split()
+
+ @pytest.mark.complete(": ${assoc1[bogus]")
+ def test_closing_curly_after_square(self, functions, completion):
+ assert completion == "${assoc1[bogus]}".split()
+
+ @pytest.mark.complete(": ${assoc1[@")
+ def test_closing_brackets_after_at(self, functions, completion):
+ assert completion == "${assoc1[@]}".split()
+
+ @pytest.mark.complete(": ${#___v")
+ def test_hash_prefix(self, functions, completion):
+ assert completion == "${#___var}".split()
diff --git a/test/unit/_filedir.exp b/test/unit/_filedir.exp
index 7395bf9a..1de49504 100644
--- a/test/unit/_filedir.exp
+++ b/test/unit/_filedir.exp
@@ -1,6 +1,6 @@
proc setup {} {
assert_bash_exec {unset COMPREPLY cur}
- assert_bash_exec {unset -f _f _fd}
+ assert_bash_exec {unset -f _f}
save_env
# Declare bash completion function `_f'
assert_bash_exec { \
@@ -11,16 +11,6 @@ proc setup {} {
assert_bash_exec { \
complete -F _f -o filenames f2 \
}
- # Declare bash completion function `_g' to complete on `.e1' files
- assert_bash_exec { \
- _g() { local cur=$(_get_cword); unset COMPREPLY; _filedir e1; }; \
- complete -F _g g \
- }
- # Declare bash completion function `_fd' to complete on dirs
- assert_bash_exec { \
- _fd() { local cur=$(_get_cword); unset COMPREPLY; _filedir -d; }; \
- complete -F _fd fd \
- }
# Create directories `a"b', `a*b', and `a\b' only when not running on
# Cygwin/Windows (`"', `*', or `\' aren't allowed in filenames there)
if {! [is_cygwin]} {
@@ -41,8 +31,8 @@ proc teardown {} {
assert_bash_exec {(cd $TESTDIR/tmp && rm -- a\*b/j && rmdir a\*b/ || true)}
}
assert_bash_exec {unset COMPREPLY cur}
- assert_bash_exec {unset -f _f _g _fd}
- assert_bash_exec {complete -r f g fd}
+ assert_bash_exec {unset -f _f}
+ assert_bash_exec {complete -r f}
assert_env_unmodified {
/OLDPWD/d
/OLD_CTYPE/d
@@ -55,21 +45,6 @@ setup
foreach name {f f2} {
- set test "completing $name ab/ should return e"
- set cmd "$name ab/"
- assert_complete_dir e $cmd "$::srcdir/fixtures/_filedir" $test
- sync_after_int
-
- set test "completing $name a\\ b/ should return i"
- set cmd "$name a\\ b/"
- assert_complete_dir i $cmd "$::srcdir/fixtures/_filedir" $test
- sync_after_int
-
- set test "completing $name a\\\'b/ should return c"
- set cmd "$name a\\\'b/"
- assert_complete_dir c $cmd "$::srcdir/fixtures/_filedir" $test
- sync_after_int
-
set test "completing $name a\\\$b/ should return h"
if {[info exists ::env(CI)] && [info exists ::env(DIST)] && $::env(DIST) == "centos6"} {
xfail $test
@@ -91,28 +66,6 @@ foreach name {f f2} {
sync_after_int
}
- set test "completing $name a\\&b/ should return f"
- set cmd "$name a\\&b/"
- assert_complete_dir f $cmd "$::srcdir/fixtures/_filedir" $test
- sync_after_int
-
- set test "completing $name a\$ should return a\\\$b/"
- set cmd "$name a\$"
- assert_complete_dir "\b\\\\\$b/" $cmd "$::srcdir/fixtures/_filedir" $test -nospace
- sync_after_int
-
- set cmd "$name 'ab/"
- assert_complete_dir {e'} $cmd "$::srcdir/fixtures/_filedir"
- sync_after_int
-
- set cmd "$name 'a b/"
- assert_complete_dir {i'} $cmd "$::srcdir/fixtures/_filedir"
- sync_after_int
-
- set cmd "$name 'a\$b/"
- assert_complete_dir {h'} $cmd "$::srcdir/fixtures/_filedir"
- sync_after_int
-
if {! [is_cygwin]} { # Illegal characters in file/dir names
set cmd "$name 'a\"b/"; #"
assert_complete_dir {d'} $cmd "$TESTDIR/tmp"
@@ -123,22 +76,6 @@ foreach name {f f2} {
sync_after_int
}
- set cmd "$name 'a&b/"
- assert_complete_dir {f'} $cmd "$::srcdir/fixtures/_filedir"
- sync_after_int
-
- set cmd "$name \"ab/"; #"
- assert_complete_dir {e"} $cmd "$::srcdir/fixtures/_filedir"; #"
- sync_after_int
-
- set cmd "$name \"a b/"; #"
- assert_complete_dir {i"} $cmd "$::srcdir/fixtures/_filedir"; #"
- sync_after_int
-
- set cmd "$name \"a'b/"; #"
- assert_complete_dir {c"} $cmd "$::srcdir/fixtures/_filedir"; #"
- sync_after_int
-
if {! [is_cygwin]} { # Illegal characters in file/dir names
set cmd "$name \"a\\\"b/"; #"
assert_complete_dir {d"} $cmd "$TESTDIR/tmp"; #"
@@ -161,20 +98,12 @@ foreach name {f f2} {
assert_complete_dir {g"} $cmd "$TESTDIR/tmp"; #"
sync_after_int
- set cmd "$name \"a&b/"; #"
- assert_complete_dir {f"} $cmd "$::srcdir/fixtures/_filedir"; #"
- sync_after_int
-
set cmd "$name \\\[x"
assert_complete_dir {\[x\]} $cmd "$::srcdir/fixtures/_filedir/brackets"
sync_after_int
}; # foreach
-set test "completing with filter '.e1' should show completions"
-assert_complete_dir {ee.e1 foo/ gg.e1 ii.E1} "g " "$::srcdir/fixtures/_filedir/ext" $test
-sync_after_int
-
set test "completing f aƩ should return g"
# Execute this test only with LC_CTYPE matching *UTF-8*
# See also: http://www.mail-archive.com/bash-completion-devel\
@@ -191,10 +120,5 @@ if {
}
sync_after_int
-set test "completing fd a\\ should return a\\ b/"
-set cmd "fd a\\ "
-assert_complete_dir "a\\ b/" $cmd "$::srcdir/fixtures/_filedir" $test -nospace
-sync_after_int
-
teardown
diff --git a/test/unit/_variables.exp b/test/unit/_variables.exp
deleted file mode 100644
index 31411d53..00000000
--- a/test/unit/_variables.exp
+++ /dev/null
@@ -1,39 +0,0 @@
-proc setup {} {
- assert_bash_exec { unset assoc1 && declare -A assoc1=([idx]=1)}
- assert_bash_exec { unset assoc2 && declare -A assoc2=([idx1]=1 [idx2]=2)}
- assert_bash_exec { unset ${!___v*} && declare ___var='' }
- save_env
-}
-
-
-proc teardown {} {
- assert_bash_exec {unset assoc1 assoc2}
-}
-
-
-setup
-
-set test "Complete simple variable names"
-assert_complete "\$___var" ": \$___v" $test
-
-set test "Complete single array index"
-assert_complete "\$\{assoc1\[idx\]\}" ": \$\{assoc1\[" $test
-sync_after_int
-
-set test "Complete closing curly bracket after square bracket"
-assert_complete "\$\{assoc1\[bogus\]\}" ": \$\{assoc1\[bogus\]" $test
-sync_after_int
-
-set test "Complete closing brackets after @ index"
-assert_complete "\$\{assoc1\[@\]\}" ": \$\{assoc1\[@" $test
-sync_after_int
-
-# For some reason -expect-cmd-minus is necessary here
-set test "Complete multiple array indexes"
-assert_complete_partial { \$\{assoc2\[idx1\]\} \$\{assoc2\[idx2\]\} } ":" "\$\{assoc2\[" $test -expect-cmd-minus "\${assoc2\["
-sync_after_int
-
-set test "Complete variables prefixed with #"
-assert_complete "\$\{#___var\}" ": \$\{#___v" $test
-
-teardown
diff --git a/test/unit/compgen.exp b/test/unit/compgen.exp
deleted file mode 100644
index 9fc1efba..00000000
--- a/test/unit/compgen.exp
+++ /dev/null
@@ -1,35 +0,0 @@
-proc setup {} {
- save_env
-}
-
-
-proc teardown {} {
- assert_env_unmodified {/OLDPWD/d}
-}
-
-
-setup
-
-
-set test {compgen -f a\\\'b/ should return a\'b/c}
-set cmd {compgen -f a\\\'b/}
-set dir $::srcdir/fixtures/compgen
-assert_bash_exec "cd $dir"
-send "$cmd\r"
-expect -ex "$cmd\r\n"
-expect {
- -re {a\\\'b/c} { pass $test }
- -re {a'b/c} { fail $test }
- -re /@ { pass "$test" }
- -re eof { unresolved "eof" }
-}
-sync_after_int
-assert_bash_exec {cd "$TESTDIR"}
-
-#assert_bash_list_dir {a\\\'b/c} $cmd $::srcdir/fixtures/compgen
-
-
-sync_after_int
-
-
-teardown
diff --git a/test/unit/quote.exp b/test/unit/quote.exp
deleted file mode 100644
index 1764e6b0..00000000
--- a/test/unit/quote.exp
+++ /dev/null
@@ -1,65 +0,0 @@
-proc setup {} {
- save_env
-}
-
-
-proc teardown {} {
- assert_env_unmodified
-}
-
-
-setup
-
-
-set cmd {quote "a b"}
-set test {quote "a b" should output 'a b'}
-send "$cmd\r"
-expect -ex "$cmd\r\n"
-expect {
- -re {'a b'} { pass $test }
- default { fail $test }
-}
-sync_after_int
-
-set cmd {quote "a b"}
-set test {quote "a b" should output 'a b'}
-send "$cmd\r"
-expect -ex "$cmd\r\n"
-expect {
- -re {'a b'} { pass $test }
- default { fail $test }
-}
-sync_after_int
-
-set cmd {quote " a "}
-set test {quote " a " should output ' a '}
-send "$cmd\r"
-expect -ex "$cmd\r\n"
-expect {
- -re {' a '} { pass $test }
- default { fail $test }
-}
-sync_after_int
-
-set cmd {quote "a'b'c"}
-set test {quote "a'b'c" should output 'a'\''b'\''c'}
-send "$cmd\r"
-expect -ex "$cmd\r\n"
-expect {
- -re {'a'\\''b'\\''c'} { pass $test }
- default { fail $test }
-}
-sync_after_int
-
-set cmd {quote "a'"}
-set test {quote "a'" should output 'a'\'''}
-send "$cmd\r"
-expect -ex "$cmd\r\n"
-expect {
- -re {'a'\\'''} { pass $test }
- default { fail $test }
-}
-sync_after_int
-
-
-teardown