示例#1
0
 def testChangeFile(self):
     PersistentObjectStorage().storage_file += ".x"
     output = TempFile.mktemp()
     self.assertIn(
         f"/tmp/{os.path.basename(PersistentObjectStorage().storage_file)}/static_tmp_1",
         output,
     )
     output = TempFile.mktemp()
     self.assertIn(
         f"/tmp/{os.path.basename(PersistentObjectStorage().storage_file)}/static_tmp_2",
         output,
     )
     PersistentObjectStorage().storage_file += ".y"
     self.assertEqual(TempFile.counter, 2)
     output = TempFile.mktemp()
     self.assertEqual(TempFile.counter, 1)
     self.assertIn(
         f"/tmp/{os.path.basename(PersistentObjectStorage().storage_file)}/static_tmp_1",
         output,
     )
     output = TempFile.mktemp()
     self.assertIn(
         f"/tmp/{os.path.basename(PersistentObjectStorage().storage_file)}/static_tmp_2",
         output,
     )
示例#2
0
 def testChangeFile(self):
     self.cassette.storage_file = str(self.cassette.storage_file) + ".x"
     output = TempFile._mktemp()
     self.assertIn(
         f"/tmp/{os.path.basename(self.cassette.storage_file)}/static_tmp_1",
         output,
     )
     output = TempFile._mktemp()
     self.assertIn(
         f"/tmp/{os.path.basename(self.cassette.storage_file)}/static_tmp_2",
         output,
     )
     self.cassette.storage_file = str(self.cassette.storage_file) + ".y"
     self.assertEqual(TempFile.counter, 2)
     output = TempFile._mktemp()
     self.assertEqual(TempFile.counter, 1)
     self.assertIn(
         f"/tmp/{os.path.basename(self.cassette.storage_file)}/static_tmp_1",
         output,
     )
     output = TempFile._mktemp()
     self.assertIn(
         f"/tmp/{os.path.basename(self.cassette.storage_file)}/static_tmp_2",
         output,
     )
示例#3
0
 def testChangeFile(self):
     STORAGE.storage_file += ".x"
     output = TempFile.mktemp()
     self.assertIn(
         f"/tmp/{os.path.basename(STORAGE.storage_file)}/static_tmp_1",
         output)
     output = TempFile.mktemp()
     self.assertIn(
         f"/tmp/{os.path.basename(STORAGE.storage_file)}/static_tmp_2",
         output)
     STORAGE.storage_file += ".y"
     self.assertEqual(TempFile.counter, 2)
     output = TempFile.mktemp()
     self.assertEqual(TempFile.counter, 1)
     self.assertIn(
         f"/tmp/{os.path.basename(STORAGE.storage_file)}/static_tmp_1",
         output)
     output = TempFile.mktemp()
     self.assertIn(
         f"/tmp/{os.path.basename(STORAGE.storage_file)}/static_tmp_2",
         output)
示例#4
0
 def testSimple(self):
     output = TempFile.mktemp()
     self.assertIn(
         f"/tmp/{os.path.basename(PersistentObjectStorage().storage_file)}/static_tmp_1",
         output,
     )
示例#5
0
 def testSimple(self):
     output = TempFile._mktemp()
     self.assertIn(
         f"/tmp/{os.path.basename(self.cassette.storage_file)}/static_tmp_1",
         output,
     )
示例#6
0
 def setUp(self) -> None:
     super().setUp()
     self.cassette.storage_file = get_datafile_filename(self.id)
     TempFile.set_cassette(self.cassette)
示例#7
0
@apply_decorator_to_all_methods(
    replace_module_match(
        what="git.repo.base.Repo.clone_from",
        decorate=StoreFiles.where_arg_references(
            key_position_params_dict={"to_path": 2},
            return_decorator=Repo.decorator_plain,
        ),
    ))
@apply_decorator_to_all_methods(
    replace_module_match(what="git.remote.Remote.push",
                         decorate=PushInfoStorageList.decorator_plain()))
@apply_decorator_to_all_methods(
    replace_module_match(what="git.remote.Remote.fetch",
                         decorate=FetchInfoStorageList.decorator_plain()))
@apply_decorator_to_all_methods(
    replace_module_match(what="tempfile.mkdtemp", decorate=TempFile.mkdtemp()))
@apply_decorator_to_all_methods(
    replace_module_match(what="tempfile.mktemp", decorate=TempFile.mktemp()))
# Be aware that decorator stores login and token to test_data, replace it by some value.
# Default precommit hook doesn't do that for copr.v3.helpers, see README.md
@apply_decorator_to_all_methods(
    replace_module_match(what="copr.v3.helpers.config_from_file",
                         decorate=Simple.decorator_plain()))
class ProposeUpdate(PackitTest):
    def cassette_setup(self, cassette):
        cassette.data_miner.data_type = DataTypes.Dict

    def setUp(self):
        super().setUp()
        self.set_git_user()
        self._api = None
# Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT

from requre.import_system import UpgradeImportSystem
from requre.helpers.tempfile import TempFile

special = UpgradeImportSystem().decorate("tempfile.mktemp", TempFile.mktemp())
示例#9
0
# Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT

from requre.import_system import UpgradeImportSystem
from requre.helpers.tempfile import TempFile

FILTERS = UpgradeImportSystem().decorate(what="tempfile.mktemp",
                                         decorator=TempFile.mktemp())