Bug 1874684 - Part 28: Return DateDuration from DifferenceISODateTime. r=mgaudet
[gecko.git] / python / mozbuild / mozbuild / test / test_vendor.py
blob07ba0883377bcb24ff801a358849595982a90e9b
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 import os
6 import shutil
7 import subprocess
8 import tempfile
9 from unittest.mock import Mock
11 import mozunit
12 from buildconfig import topsrcdir
14 from mozbuild.vendor.vendor_python import VendorPython
17 def test_up_to_date_vendor():
18 with tempfile.TemporaryDirectory() as work_dir:
19 subprocess.check_call(["hg", "init", work_dir])
20 os.makedirs(os.path.join(work_dir, "third_party"))
21 shutil.copytree(
22 os.path.join(topsrcdir, os.path.join("third_party", "python")),
23 os.path.join(work_dir, os.path.join("third_party", "python")),
26 # Run the vendoring process
27 vendor = VendorPython(
28 work_dir, None, Mock(), topobjdir=os.path.join(work_dir, "obj")
30 vendor.vendor()
32 # Verify that re-vendoring did not cause file changes.
33 # Note that we don't want hg-ignored generated files
34 # to bust the diff, so we exclude them (pycache, egg-info).
35 subprocess.check_call(
37 "diff",
38 "-r",
39 os.path.join(topsrcdir, os.path.join("third_party", "python")),
40 os.path.join(work_dir, os.path.join("third_party", "python")),
41 "--exclude=__pycache__",
42 "--strip-trailing-cr",
47 if __name__ == "__main__":
48 mozunit.main()