MycroftAI / mycroft-skills-manager

Mycroft Skills Manager
Apache License 2.0
14 stars 13 forks source link

Test failure when used with distro packaging #80

Open PureTryOut opened 4 years ago

PureTryOut commented 4 years ago

As part of my effort to package the entirety of MyCroft for Alpine Linux, I'm now trying to get MSM tests working. They all succeed except for test_main.py:

================================================ test session starts ================================================
platform linux -- Python 3.8.5, pytest-6.0.1, py-1.9.0, pluggy-0.13.1
rootdir: /home/bart/Documents/Git/alpine/aports/testing/mycroft-skills-manager/src/mycroft-skills-manager-0.8.8
collected 28 items                                                                                                  

tests/test_main.py F                                                                                          [  3%]
tests/test_mycroft_skills_manager.py ...........                                                              [ 42%]
tests/test_skill_entry.py ............                                                                        [ 85%]
tests/test_skill_repo.py ....                                                                                 [100%]

===================================================== FAILURES ======================================================
___________________________________________________ TestMain.test ___________________________________________________

self = <test_main.TestMain object at 0x7f0169b9dd90>

    def test(self):
        skill_names = {'skill-a', 'skill-b', 'skill-cd', 'skill-ce'}
        assert set(self('-r list')) == skill_names
        self('install skill-a')
>       self('install skill-b')

tests/test_main.py:64: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <test_main.TestMain object at 0x7f0169b9dd90>, args = ('install skill-b',)
params = ['-u', 'https://github.com/mycroftai/mycroft-skills-manager', '-b', 'test-repo', '-c', '/home/bart/Documents/Git/alpine/aports/testing/mycroft-skills-manager/src/mycroft-skills-manager-0.8.8/tests/repo-instance', ...]
printer = <function TestMain.__call__.<locals>.printer at 0x7f016ac2c670>, ret = 230

    def __call__(self, *args):
        params = self.base_params + ' '.join(map(str, args)).split(' ')

        lines = []

        def printer(text):
            lines.extend(map(str.strip, text.split('\n')))
        print('CALLING:', params)
        ret = main(params, printer)
        if ret != 0:
>           raise ValueError('Returned: {} with output {}'.format(
                ret, ' '.join(lines)
            ))
E           ValueError: Returned: 230 with output PipRequirementsException: Pip returned code 2:  Permission denied while installing pip dependencies. Please run in virtualenv or use sudo

tests/test_main.py:55: ValueError

It seems it expects to be ran in a virtualenv or with root rights. Both of these are not available in usual distro build systems and it makes the test fail.

krisgesling commented 4 years ago

Hey, thanks for flagging this.

Looks like it is going to need some more digging so have tagged with help wanted for now.

Hopefully someone comes forward with a hypothesis.