Пример #1
0
 def test_bad_commands(self):
     sources_cache = get_cache_dir()
     cmd_extras = ['-c', sources_cache]
     for commands in [[], ['fake', 'something'], ['check'], ['install', '-a', 'rospack_fake'],
                      ['check', 'rospack_fake', '--os', 'ubuntulucid'],
                      ]:
         try:
             xylem_main(commands+cmd_extras)
             assert False, "system exit should have occurred"
         except SystemExit:
             pass
Пример #2
0
 def test_where_defined(self):
     try:
         sources_cache = get_cache_dir()
         expected = GITHUB_PYTHON_URL 
         for command in (['where_defined', 'testpython'], ['where_defined', 'testpython']):
             with fakeout() as b:
                 # set os to ubuntu so this test works on different platforms
                 xylem_main(command + ['-c', sources_cache, '--os=ubuntu:lucid'])
                 stdout, stderr = b
                 output = stdout.getvalue().strip()
                 assert output == expected, output
     except SystemExit:
         assert False, "system exit occurred"
Пример #3
0
 def test_what_needs(self):
     try:
         sources_cache = get_cache_dir()
         cmd_extras = ['-c', sources_cache]
         expected = ['python_dep']
         with fakeout() as b:
             xylem_main(['what-needs', 'testpython']+cmd_extras)
             stdout, stderr = b
             output = stdout.getvalue().strip()
             assert output.split('\n') == expected
         expected = ['python_dep']
         with fakeout() as b:
             xylem_main(['what_needs', 'testpython', '--os', 'ubuntu:lucid', '--verbose']+cmd_extras)
             stdout, stderr = b
             output = stdout.getvalue().strip()
             assert output.split('\n') == expected
     except SystemExit:
         assert False, "system exit occurred"
Пример #4
0
    def test_check(self):
        sources_cache = get_cache_dir()
        cmd_extras = ['-c', sources_cache]

        with fakeout() as b:
            try:
                xylem_main(['check', 'python_dep']+cmd_extras)
            except SystemExit:
                assert False, "system exit occurred: %s\n%s"%(b[0].getvalue(), b[1].getvalue())

            stdout, stderr = b
            assert stdout.getvalue().strip() == "All system dependencies have been satisified", stdout.getvalue()
            assert not stderr.getvalue(), stderr.getvalue()
        try:
            osd = .os_detect.OsDetect()
            override = "%s:%s"%(osd.get_name(), osd.get_codename())
            with fakeout() as b:
                xylem_main(['check', 'python_dep', '--os', override]+cmd_extras)
                stdout, stderr = b
                assert stdout.getvalue().strip() == "All system dependencies have been satisified"
                assert not stderr.getvalue(), stderr.getvalue()
        except SystemExit:
            assert False, "system exit occurred"

        # this used to abort, but now xylem assumes validity for even empty stack args
        try:
            with fakeout() as b:
                xylem_main(['check', 'packageless']+cmd_extras)
                stdout, stderr = b
                assert stdout.getvalue().strip() == "All system dependencies have been satisified"
                assert not stderr.getvalue(), stderr.getvalue()
        except SystemExit:
            assert False, "system exit occurred"

        try:
            xylem_main(['check', 'nonexistent']+cmd_extras)
            assert False, "system exit should have occurred"
        except SystemExit:
            pass
Пример #5
0
    def test_keys(self):
        sources_cache = get_cache_dir()
        cmd_extras = ['-c', sources_cache]

        try:
            with fakeout() as b:
                xylem_main(['keys', 'rospack_fake']+cmd_extras)
                stdout, stderr = b
                assert stdout.getvalue().strip() == "testtinyxml", stdout.getvalue()
                assert not stderr.getvalue(), stderr.getvalue()
            with fakeout() as b:
                xylem_main(['keys', 'rospack_fake', '--os', 'ubuntu:lucid', '--verbose']+cmd_extras)
                stdout, stderr = b
                assert stdout.getvalue().strip() == "testtinyxml", stdout.getvalue()
        except SystemExit:
            assert False, "system exit occurred"
        try:
            xylem_main(['keys', 'nonexistent']+cmd_extras)
            assert False, "system exit should have occurred"
        except SystemExit:
            pass
Пример #6
0
    def test_install(self):
        sources_cache = get_cache_dir()
        cmd_extras = ['-c', sources_cache]

        try:
            # python must have already been installed
            with fakeout() as b:
                xylem_main(['install', 'python_dep']+cmd_extras)
                stdout, stderr = b
                assert "All required packages installed" in stdout.getvalue(), stdout.getvalue()
                assert not stderr.getvalue(), stderr.getvalue()
            with fakeout() as b:
                xylem_main(['install', 'python_dep', '-r']+cmd_extras)
                stdout, stderr = b
                assert "All required packages installed" in stdout.getvalue(), stdout.getvalue()
                assert not stderr.getvalue(), stderr.getvalue()
        except SystemExit:
            assert False, "system exit occurred: "+b[1].getvalue()
        try:
            xylem_main(['check', 'nonexistent'])
            assert False, "system exit should have occurred"
        except SystemExit:
            pass