def setUp(self): filter_ = config.get('filter', None) if filter_: if not re.match(filter_, self.snap_content_dir): self.skipTest( '{} does not match the filter {}'.format( self.snap_content_dir, filter_)) logger.info('Testing {}'.format(self.snap_content_dir)) super().setUp() if os.getenv('SNAPCRAFT_FROM_INSTALLED', False): self.snapcraft_command = 'snapcraft' else: self.snapcraft_command = os.path.join( os.getcwd(), 'bin', 'snapcraft') self.useFixture(fixtures.EnvironmentVariable('TERM', 'dumb')) temp_dir = fixtures.TempDir() self.useFixture(temp_dir) self.path = temp_dir.path self.snappy_testbed = None if not config.get('skip-install', False): ip = config.get('ip', None) if not ip or ip in ('localhost', '127.0.0.1'): self.snappy_testbed = testbed.LocalTestbed() else: port = config.get('port', None) or '22' proxy = config.get('proxy', None) self.snappy_testbed = testbed.SshTestbed( ip, port, 'ubuntu', proxy) self.snappy_testbed.wait()
def setUp(self): filter_ = config.get('filter', None) if filter_: if not re.match(filter_, self.snap_content_dir): self.skipTest( '{} does not match the filter {}'.format( self.snap_content_dir, filter_)) super().setUp() if os.getenv('SNAPCRAFT_FROM_INSTALLED', False): self.snapcraft_command = 'snapcraft' else: self.snapcraft_command = os.path.join( os.getcwd(), 'bin', 'snapcraft') self.useFixture( fixtures.EnvironmentVariable('SNAPCRAFT_SETUP_PROXIES', '1')) self.snappy_testbed = None if not config.get('skip-install', False): ip = config.get('ip', None) if not ip: self.snappy_testbed = self._set_up_qemu_testbed() elif ip in ('localhost', '127.0.0.1'): self.snappy_testbed = testbed.LocalTestbed() else: port = config.get('port', None) or '22' self.snappy_testbed = testbed.SshTestbed( ip, port, 'ubuntu') self.snappy_testbed.wait()
def setUp(self): filter_ = config.get('filter', None) if filter_: if not re.match(filter_, self.snap_content_dir): self.skipTest( '{} does not match the filter {}'.format( self.snap_content_dir, filter_)) logger.info('Testing {}'.format(self.snap_content_dir)) super().setUp() self.patchelf_command = 'patchelf' if os.getenv('SNAPCRAFT_FROM_SNAP', False): self.snapcraft_command = '/snap/bin/snapcraft' self.patchelf_command = '/snap/snapcraft/current/bin/patchelf' elif os.getenv('SNAPCRAFT_FROM_DEB', False): self.snapcraft_command = '/usr/bin/snapcraft' elif os.getenv('VIRTUAL_ENV'): self.snapcraft_command = os.path.join( os.getenv('VIRTUAL_ENV'), 'bin', 'snapcraft') self.snapcraft_parser_command = os.path.join( os.getenv('VIRTUAL_ENV'), 'bin', 'snapcraft-parser') else: raise EnvironmentError( 'snapcraft is not setup correctly for testing. Either set ' 'SNAPCRAFT_FROM_SNAP or SNAPCRAFT_FROM_DEB to run from either ' 'the snap or deb, or make sure your venv is properly setup ' 'as described in HACKING.md.') self.useFixture(fixtures.EnvironmentVariable('TERM', 'dumb')) temp_dir = fixtures.TempDir() self.useFixture(temp_dir) self.path = temp_dir.path self.snappy_testbed = None if not config.get('skip-install', False): ip = config.get('ip', None) if not ip or ip in ('localhost', '127.0.0.1'): self.snappy_testbed = testbed.LocalTestbed() else: port = config.get('port', None) or '22' proxy = config.get('proxy', None) self.snappy_testbed = testbed.SshTestbed( ip, port, 'ubuntu', proxy) self.snappy_testbed.wait()
def setUp(self): filter_ = config.get("filter", None) if filter_: if not re.match(filter_, self.snap_content_dir): self.skipTest("{} does not match the filter {}".format( self.snap_content_dir, filter_)) logger.info("Testing {}".format(self.snap_content_dir)) super().setUp() self.patchelf_command = "patchelf" package_type = os.getenv("SNAPCRAFT_PACKAGE_TYPE") if package_type == "snap": self.snapcraft_command = "/snap/bin/snapcraft" self.patchelf_command = "/snap/snapcraft/current/usr/bin/patchelf" elif package_type == "deb": self.snapcraft_command = "/usr/bin/snapcraft" elif os.getenv("VIRTUAL_ENV"): self.snapcraft_command = os.path.join(os.getenv("VIRTUAL_ENV"), "bin", "snapcraft") self.snapcraft_parser_command = os.path.join( os.getenv("VIRTUAL_ENV"), "bin", "snapcraft-parser") else: raise EnvironmentError( "snapcraft is not setup correctly for testing. Either set " "SNAPCRAFT_PACKAGE_TYPE to 'snap' or 'deb', to run from either " "the snap or deb, or make sure your venv is properly setup " "as described in HACKING.md.") self.useFixture(fixtures.EnvironmentVariable("TERM", "dumb")) temp_dir = fixtures.TempDir() self.useFixture(temp_dir) self.path = temp_dir.path self.snappy_testbed = None if not config.get("skip-install", False): ip = config.get("ip", None) if not ip or ip in ("localhost", "127.0.0.1"): self.snappy_testbed = testbed.LocalTestbed() else: port = config.get("port", None) or "22" proxy = config.get("proxy", None) self.snappy_testbed = testbed.SshTestbed( ip, port, "ubuntu", proxy) self.snappy_testbed.wait()