diff --git a/bam/blend/blendfile_path_walker.py b/bam/blend/blendfile_path_walker.py index 1c7b027..df07235 100644 --- a/bam/blend/blendfile_path_walker.py +++ b/bam/blend/blendfile_path_walker.py @@ -581,6 +581,11 @@ class FilePath: if block[b'source_mode'] == C_defs.CACHE_LIBRARY_SOURCE_CACHE: yield FPElem_block_path(basedir, level, (block, b'input_filepath')), extra_info + @staticmethod + def _from_block_CF(block, basedir, extra_info, level): + yield FPElem_block_path(basedir, level, (block, b'filepath')), extra_info + + @staticmethod def _from_block_SC(block, basedir, extra_info, level): block_ed = block.get_pointer(b'ed') diff --git a/tests/blends/cube-rotating.abc b/tests/blends/cube-rotating.abc new file mode 100644 index 0000000..22c34b2 Binary files /dev/null and b/tests/blends/cube-rotating.abc differ diff --git a/tests/blends/cube-rotating.blend b/tests/blends/cube-rotating.blend new file mode 100644 index 0000000..d5819ff Binary files /dev/null and b/tests/blends/cube-rotating.blend differ diff --git a/tests/test_cli.py b/tests/test_cli.py index 574661f..137ffc9 100755 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -16,9 +16,11 @@ Run a single test: import argparse import json import os +from pathlib import Path import shutil import sys import unittest +import unittest.mock VERBOSE = os.environ.get("VERBOSE", False) if VERBOSE == "0": @@ -1766,6 +1768,30 @@ class BamRemapTest(BamSimpleTestCase): self.assertEqual(ret[1][3], "OK") +class BamDepsTest(unittest.TestCase): + @unittest.mock.patch('bam.cli.print') + def test_abc_cache_modifier(self, mock_print): + from bam.cli import bam_commands + + printed = [] + + def record_print(*stuff, sep=' ', end='\n'): + printed.append(sep.join(stuff) + end) + + mock_print.side_effect = record_print + + blendpath = Path(__file__).absolute().parent / 'blends' / 'cube-rotating.blend' + bam_commands.deps([str(blendpath)], recursive=False, use_json=True) + + output = json.loads(''.join(printed)) + self.assertEqual([[ + str(blendpath), + '//cube-rotating.abc', + str(blendpath.with_name('cube-rotating.abc')), + 'OK' + ]], output) + + if __name__ == '__main__': data = global_setup() unittest.main(exit=False)