Exemplo n.º 1
0
    def test_config_show(self):
        err = self.call('python -m signac config --local show'.split(),
                        error=True).strip()
        assert 'Did not find a local configuration file' in err

        self.call('python -m signac init my_project'.split())
        out = self.call('python -m signac config --local show'.split()).strip()
        cfg = config.read_config_file('signac.rc')
        expected = config.Config(cfg).write()
        assert out.split(os.linesep) == expected

        out = self.call('python -m signac config show'.split()).strip()
        cfg = config.load_config()
        expected = config.Config(cfg).write()
        assert out.split(os.linesep) == expected

        out = self.call(
            'python -m signac config --global show'.split()).strip()
        cfg = config.read_config_file(config.FN_CONFIG)
        expected = config.Config(cfg).write()
        assert out.split(os.linesep) == expected
Exemplo n.º 2
0
 def run(self):
     super(InstallAndConfig, self).run()
     cfg = config.read_config_file(config.FN_CONFIG)
     try:
         envs = cfg['flow'].as_list('environment_modules')
     except KeyError:
         envs = []
     new = set(py_modules).difference(envs)
     if new:
         for name in new:
             self.announce(
                 msg="registering module '{}' in global signac configuration".format(name),
                 level=2)
         cfg.setdefault('flow', dict())
         cfg['flow']['environment_modules'] = envs + list(new)
         cfg.write()
Exemplo n.º 3
0
 def run(self):
     super().run()
     cfg = config.read_config_file(config.FN_CONFIG)
     try:
         envs = cfg["flow"].as_list("environment_modules")
     except KeyError:
         envs = []
     new = set(py_modules).difference(envs)
     if new:
         for name in new:
             self.announce(
                 msg=
                 f"registering module '{name}' in global signac configuration",
                 level=2,
             )
         cfg.setdefault("flow", {})
         cfg["flow"]["environment_modules"] = envs + list(new)
         cfg.write()