Created
March 10, 2017 15:13
-
-
Save apahim/d1acda76d9700deccd5146037427ab62 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from avocado import Test | |
from avocado import main | |
from avocado.utils.process import run | |
from avocado.utils.software_manager import SoftwareManager | |
class CancelTest(Test): | |
""" | |
Example tests that cancel the current test from inside the test. | |
""" | |
def setUp(self): | |
sm = SoftwareManager() | |
self.pkgs = sm.list_all(software_components=False) | |
def test_iperf(self): | |
if 'iperf-2.0.8-6.fc25.x86_64' not in self.pkgs: | |
self.cancel('iperf is not installed or wrong version') | |
self.assertIn('pthreads', run('iperf -v', ignore_status=True).stderr) | |
def test_gcc(self): | |
if 'gcc-6.3.1-1.fc25.x86_64' not in self.pkgs: | |
self.cancel('gcc is not installed or wrong version') | |
self.assertIn('enable-gnu-indirect-function', run('gcc -v').stderr) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment