perl/tests/cpan.py
2017-05-29 12:09:43 +02:00

57 lines
1.9 KiB
Python

#
# This Modularity Testing Framework helps you to write tests for modules
# Copyright (C) 2017 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# he Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Authors: Rado Pitonak <rpitonak@redhat.com>
#
from avocado import main
from avocado.core import exceptions
from moduleframework import module_framework
class CpanCheck(module_framework.AvocadoTest):
"""
:avocado: enable
"""
def testInstallPerlModule(self):
"""
Installing Perl module using cpan [http://www.cpan.org/]
"""
self.start()
self.run("microdnf --nodocs --enablerepo fedora install -y cpan cpanminus")
self.run("cpanm install --force Error")
self.run("perl -e \"use Error\"")
def testInstallCModule(self):
"""
Installing Perl module written in C language, using cpan [http://www.cpan.org/]
Another packages need to be install here - gcc, rpm-devel to build module.
"""
self.start()
self.run("microdnf --nodocs --enablerepo fedora install -y cpan cpanminus")
self.run("microdnf --nodocs --enablerepo fedora install -y gcc rpm-devel")
self.run("cpanm install --force RPM2")
self.run("perl -e \"use RPM2\"")
if __name__ == '__main__':
main()