コード例 #1
0
    def test_tox_cleanup_file_does_not_exist(self):
        original_dir = getcwd()
        print('The tox_cleanup started in', original_dir)

        cwd = original_dir

        if cwd.endswith('unit_tests'):
            up2 = path.join('..', '..')
            chdir(up2)
            cwd = getcwd()

        settings_path = path.join(cwd, 'blowdrycss_settings.py')

        if path.isfile(settings_path):
            remove(settings_path)                                       # Delete blowdrycss_settings.py if it exists.

        self.assertFalse(path.isfile(settings_path), msg=settings_path)
        tox_cleanup.main()
        self.assertFalse(path.isfile(settings_path), msg=settings_path)

        chdir(original_dir)                                             # Reset directory
コード例 #2
0
    def test_tox_cleanup_file_exists(self):
        original_dir = getcwd()
        print('The tox_cleanup started in', original_dir)

        cwd = original_dir
        module_path = path.join(cwd, 'blowdrycss')                      # Prevent removal of source settings file.

        if cwd.endswith('unit_tests') and not path.isdir(module_path):
            up2 = path.join('..', '..')
            chdir(up2)
            cwd = getcwd()

        settings_path = path.join(cwd, 'blowdrycss_settings.py')

        if not path.isfile(settings_path):
            create_file(file_path=settings_path)

        self.assertTrue(path.isfile(settings_path), msg=settings_path)
        tox_cleanup.main()
        self.assertFalse(path.isfile(settings_path), msg=settings_path)

        chdir(original_dir)                                             # Reset directory