105 """Tests that we exit with an error on wrong or missing args""" |
105 """Tests that we exit with an error on wrong or missing args""" |
106 for opt in ["-x", "--asdf" ]: |
106 for opt in ["-x", "--asdf" ]: |
107 ret, output, err = self.pkglint(opt, exit=2) |
107 ret, output, err = self.pkglint(opt, exit=2) |
108 |
108 |
109 def test_3_list(self): |
109 def test_3_list(self): |
110 """Tests that a given checker method is listed with -L.""" |
110 """Tests that -L prints headers and descriptions or methods.""" |
111 ret, output, err = self.pkglint("-L") |
111 for flag in ["-L", "-vL"]: |
112 self.assert_( |
112 ret, output, err = self.pkglint(flag) |
113 "pkg.lint.pkglint_action.PkgDupActionChecker.duplicate_paths" |
113 self.assert_("pkglint.dupaction001" in output, |
114 in output, "List output didn't show expected checker") |
114 "short name didn't appear in %s output" % flag) |
|
115 |
|
116 self.assert_("NAME" in output, |
|
117 "Header not printed in %s output" % flag) |
|
118 if flag == "-vL": |
|
119 self.assert_( |
|
120 "pkg.lint.pkglint_action.PkgDupActionChecker.duplicate_paths" |
|
121 in output, |
|
122 "verbose list output didn't show method") |
|
123 elif flag == "-L": |
|
124 self.assert_( |
|
125 "Paths should be unique." in output, |
|
126 "description didn't appear in -L output: %s" % output) |
115 |
127 |
116 def test_4_manifests(self): |
128 def test_4_manifests(self): |
117 """Tests that we exit normally with a correct manifest.""" |
129 """Tests that we exit normally with a correct manifest.""" |
118 mpath = self.make_manifest(self.manifest) |
130 mpath = self.make_manifest(self.manifest) |
119 self.pkglint(mpath) |
131 self.pkglint(mpath) |
144 self.pkglint("-f %s/rcfile %s" % (self.test_root, mpath1), |
156 self.pkglint("-f %s/rcfile %s" % (self.test_root, mpath1), |
145 testrc=False, exit=0) |
157 testrc=False, exit=0) |
146 self.pkglint("-f %s/rcfile1 %s" % (self.test_root, mpath1), |
158 self.pkglint("-f %s/rcfile1 %s" % (self.test_root, mpath1), |
147 exit=0) |
159 exit=0) |
148 |
160 |
149 ret, output, err = self.pkglint("-f %s/rcfile -L" % |
161 ret, output, err = self.pkglint("-f %s/rcfile -vL" % |
150 self.test_root, testrc=False, exit=0) |
162 self.test_root, testrc=False, exit=0) |
151 self.assert_( |
163 self.assert_( |
152 "pkg.lint.pkglint_manifest.PkgManifestChecker.duplicate_sets" |
164 "pkg.lint.pkglint_manifest.PkgManifestChecker.duplicate_sets" |
153 in output, "List output missing excluded checker") |
165 in output, "List output missing excluded checker") |
154 self.assert_("Excluded checks:" in output) |
166 self.assert_("Excluded checks:" in output) |
155 |
167 |
156 ret, output, err = self.pkglint("-f %s/rcfile1 -L" % |
168 ret, output, err = self.pkglint("-f %s/rcfile1 -vL" % |
157 self.test_root, testrc=False, exit=0) |
169 self.test_root, testrc=False, exit=0) |
158 self.assert_( |
170 self.assert_( |
159 "pkg.lint.pkglint_manifest.PkgManifestChecker.duplicate_sets" |
171 "pkg.lint.pkglint_manifest.PkgManifestChecker.duplicate_sets" |
160 in output, "List output missing excluded checker") |
172 in output, "List output missing excluded checker") |
161 self.assert_("Excluded checks:" in output) |
173 self.assert_("Excluded checks:" in output) |