diff options
Diffstat (limited to 'tests/utils/misc.py')
-rw-r--r-- | tests/utils/misc.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/utils/misc.py b/tests/utils/misc.py new file mode 100644 index 000000000..ae584e4d5 --- /dev/null +++ b/tests/utils/misc.py @@ -0,0 +1,30 @@ +from buildstream import _yaml +from ..testutils import mock_os +from ..testutils.runcli import cli + +import os +import pytest + + +KiB = 1024 +MiB = (KiB * 1024) +GiB = (MiB * 1024) +TiB = (GiB * 1024) + + +def test_parse_size_over_1024T(cli, tmpdir): + BLOCK_SIZE = 4096 + cli.configure({ + 'cache': { + 'quota': 2048 * TiB + } + }) + project = tmpdir.join("main") + os.makedirs(str(project)) + _yaml.dump({'name': 'main'}, str(project.join("project.conf"))) + + bavail = (1025 * TiB) / BLOCK_SIZE + patched_statvfs = mock_os.mock_statvfs(f_bavail=bavail, f_bsize=BLOCK_SIZE) + with mock_os.monkey_patch("statvfs", patched_statvfs): + result = cli.run(project, args=["build", "file.bst"]) + assert "1025T of available system storage" in result.stderr |