diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /python/mozbuild/mozbuild/test/test_vendor.py | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'python/mozbuild/mozbuild/test/test_vendor.py')
-rw-r--r-- | python/mozbuild/mozbuild/test/test_vendor.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/python/mozbuild/mozbuild/test/test_vendor.py b/python/mozbuild/mozbuild/test/test_vendor.py new file mode 100644 index 0000000000..07ba088337 --- /dev/null +++ b/python/mozbuild/mozbuild/test/test_vendor.py @@ -0,0 +1,48 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +import os +import shutil +import subprocess +import tempfile +from unittest.mock import Mock + +import mozunit +from buildconfig import topsrcdir + +from mozbuild.vendor.vendor_python import VendorPython + + +def test_up_to_date_vendor(): + with tempfile.TemporaryDirectory() as work_dir: + subprocess.check_call(["hg", "init", work_dir]) + os.makedirs(os.path.join(work_dir, "third_party")) + shutil.copytree( + os.path.join(topsrcdir, os.path.join("third_party", "python")), + os.path.join(work_dir, os.path.join("third_party", "python")), + ) + + # Run the vendoring process + vendor = VendorPython( + work_dir, None, Mock(), topobjdir=os.path.join(work_dir, "obj") + ) + vendor.vendor() + + # Verify that re-vendoring did not cause file changes. + # Note that we don't want hg-ignored generated files + # to bust the diff, so we exclude them (pycache, egg-info). + subprocess.check_call( + [ + "diff", + "-r", + os.path.join(topsrcdir, os.path.join("third_party", "python")), + os.path.join(work_dir, os.path.join("third_party", "python")), + "--exclude=__pycache__", + "--strip-trailing-cr", + ] + ) + + +if __name__ == "__main__": + mozunit.main() |