File: run-unit-test

package info (click to toggle)
q2cli 2024.5.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,120 kB
  • sloc: python: 8,231; sh: 88; makefile: 45
file content (124 lines) | stat: -rw-r--r-- 2,673 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/sh -e

pkg=q2cli

if [ "${AUTOPKGTEST_TMP}" = "" ] ; then
  AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
  trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
fi

cd "${AUTOPKGTEST_TMP}"

export HOME=${HOME:-$PWD}

QZA_SAMPLE="/usr/lib/python3/dist-packages/q2_sample_classifier/tests/data/vaw.qza"
if [ ! -r "$QZA_SAMPLE" ]
then
	cat >&2 <<-ERR
	error: could not find sample data: $QZA_SAMPLE
	       Please install q2-sample-classifier
	ERR
	exit 1
fi

# TODO: same tests but with recommended dependencies!
#       This is important since there is a huge change of behavior, and
#       extensions may potentially break the qiime command as I am seeing with
#       python3-sklearn at the moment.
set -v
# 0. the basics
	qiime --version

# 1. help messages
	qiime --help
	qiime info --help
	qiime tools --help
	qiime dev --help
	qiime tools citations --help
	qiime tools export --help
	qiime tools extract --help
	qiime tools import --help
	qiime tools inspect-metadata --help
	qiime tools peek --help
	qiime tools validate --help
	qiime tools view --help
	qiime dev export-default-theme --help
	qiime dev import-theme --help
	qiime dev refresh-cache --help
	qiime dev reset-theme --help

# 2. info command
	qiime info

# 3. tools commands
	qiime tools

	qiime tools citations "$QZA_SAMPLE" > citations.bib
	file citations.bib | grep -qi 'bibtex'

	qiime tools export --input-path "$QZA_SAMPLE" --output-path .
	file feature-table.biom | grep -qi 'Hierarchical Data Format'

	qiime tools extract --input-path "$QZA_SAMPLE"
	cd 861451cc-c250-43fc-818a-ddc2159dbe25
		md5sum --check checksums.md5
	cd -

	qiime tools inspect-metadata "$QZA_SAMPLE" --tsv > metadata.tsv
	qiime tools inspect-metadata "$QZA_SAMPLE" --no-tsv

	qiime tools peek "$QZA_SAMPLE"

	qiime tools import \
		--type 'FeatureTable[Frequency]' \
		--input-path '861451cc-c250-43fc-818a-ddc2159dbe25/data' \
		--output-path artifact.qza
	file artifact.qza | grep -qi 'zip archive data'

	qiime tools validate artifact.qza

	# TODO test qiime tools view, missing Vizualization data at the moment,
	# most likely available under the form of *.qvz files.

# 4. dev commands
	qiime dev
	qiime dev export-default-theme --output-path file.theme
	diff file.theme - <<-END
	[option]
	fg = bright_blue

	[type]
	fg = green

	[default_arg]
	fg = magenta

	[command]
	fg = bright_blue

	[emphasis]
	underline = True

	[problem]
	fg = yellow

	[warning]
	fg = yellow
	bold = True

	[error]
	fg = red
	bold = True

	[required]
	underline = True

	[success]
	fg = green

	END
	qiime dev import-theme --theme file.theme
	qiime dev refresh-cache
	yes | qiime dev reset-theme

echo "\nRESULTS: OK\n"