コード例 #1
0
    def test_yml_or_yaml_path(self):
        temp_dir = tempfile.gettempdir()

        fd, temp_path = tempfile.mkstemp(suffix='.yml')
        os.close(fd)
        rootname = os.path.splitext(os.path.basename(temp_path))[0]
        self.assertEqual(temp_path, yml_or_yaml_path(temp_dir, rootname))
        os.remove(temp_path)

        fd, temp_path = tempfile.mkstemp(suffix='.yaml')
        os.close(fd)
        rootname = os.path.splitext(os.path.basename(temp_path))[0]
        self.assertEqual(temp_path, yml_or_yaml_path(temp_dir, rootname))
        os.remove(temp_path)
コード例 #2
0
ファイル: yaml_util_test.py プロジェクト: PioTi/spinnaker
  def test_yml_or_yaml_path(self):
    temp_dir = tempfile.gettempdir()

    fd, temp_path = tempfile.mkstemp(suffix='.yml')
    os.close(fd)
    rootname = os.path.splitext(os.path.basename(temp_path))[0]
    self.assertEqual(temp_path, yml_or_yaml_path(temp_dir, rootname))
    os.remove(temp_path)

    fd, temp_path = tempfile.mkstemp(suffix='.yaml')
    os.close(fd)
    rootname = os.path.splitext(os.path.basename(temp_path))[0]
    self.assertEqual(temp_path, yml_or_yaml_path(temp_dir, rootname))
    os.remove(temp_path)
コード例 #3
0
    def test_yml_or_yaml_both(self):
        temp_dir = tempfile.gettempdir()
        fd, yml_path = tempfile.mkstemp(suffix='.yml')
        os.close(fd)
        rootname = os.path.splitext(os.path.basename(yml_path))[0]

        yaml_path = os.path.join(temp_dir, rootname) + '.yaml'
        with open(yaml_path, 'w') as f:
            pass

        # Both cases raise exception
        with self.assertRaises(ValueError):
            yml_or_yaml_path(temp_dir, rootname)
        os.remove(yml_path)
        os.remove(yaml_path)
コード例 #4
0
ファイル: yaml_util_test.py プロジェクト: PioTi/spinnaker
  def test_yml_or_yaml_both(self):
    temp_dir = tempfile.gettempdir()
    fd, yml_path = tempfile.mkstemp(suffix='.yml')
    os.close(fd)
    rootname = os.path.splitext(os.path.basename(yml_path))[0]

    yaml_path = os.path.join(temp_dir, rootname) + '.yaml'
    with open(yaml_path, 'w') as f:
      pass

    # Both cases raise exception
    with self.assertRaises(ValueError):
      yml_or_yaml_path(temp_dir, rootname)
    os.remove(yml_path)
    os.remove(yaml_path)
コード例 #5
0
 def test_yml_or_yaml_neither(self):
     the_dir = '/no/such/dir'
     self.assertEqual(
         os.path.join(the_dir, 'bogus') + '.yml',
         yml_or_yaml_path(the_dir, 'bogus'))
コード例 #6
0
ファイル: yaml_util_test.py プロジェクト: PioTi/spinnaker
 def test_yml_or_yaml_neither(self):
   the_dir = '/no/such/dir'
   self.assertEqual(os.path.join(the_dir, 'bogus') + '.yml',
                    yml_or_yaml_path(the_dir, 'bogus'))