swiftlang/swift

Add test coverage for `update-checkout --stash` option

Open

#72,523 创建于 2024年3月22日

在 GitHub 查看
 (3 评论) (0 反应) (1 负责人)Swift (10,719 fork)batch import
contributor experiencegood first issuetest suiteupdate-checkoututils

仓库指标

Star
 (69,989 star)
PR 合并指标
 (平均合并 8天 17小时) (30 天内合并 510 个 PR)

描述

update-checkout has a Python unit test suite at utils/update_checkout/tests. You can run it using utils/update_checkout/run_tests.py or lit + validation-test/Python/update_checkout.swift. The test suite is centered around an intermediary unittest.TestCase subclass from which all the effective test classes inherit. This base class is responsible for setting up and tearing down a mock-up environment consisting of a directory of local remotes and a source root — a directory for their clones. Subclasses define test functions that run update-checkout commands against these mock repositories and perform state checks.

I think a single test function that

  1. clones the remotes using update-checkout
  2. creates some untracked files in several clones
  3. runs update-checkout with --stash
  4. verifies that the untracked files have indeed been stashed and nothing else happened

would good enough for now (the update/clone tests, if any, are really basic anyway). I would place this function in a new subclass in its own file.

Originally posted by @AnthonyLatsis in https://github.com/apple/swift/issues/71178#issuecomment-2015764863

贡献者指南