[Notes] [Git][BuildStream/buildstream][BenjaminSchubert/fix-quota-tests] Mock calls to artifact_cache_size computation when testing quota



Title: GitLab

Benjamin Schubert pushed to branch BenjaminSchubert/fix-quota-tests at BuildStream / buildstream

Commits:

1 changed file:

Changes:

  • tests/artifactcache/expiry.py
    ... ... @@ -266,16 +266,24 @@ def test_invalid_cache_quota(cli, datafiles, tmpdir, quota, success):
    266 266
             }
    
    267 267
         })
    
    268 268
     
    
    269
    -    with mock.patch(
    
    270
    -            "os.statvfs",
    
    271
    -            autospec=True,
    
    272
    -            return_value=mock.create_autospec(
    
    273
    -                "os.statvfs_result",
    
    274
    -                f_blocks=1000,
    
    275
    -                f_bsize=10,
    
    276
    -                f_bavail=600,
    
    277
    -            )
    
    278
    -    ):
    
    269
    +    statvfs_patch = mock.patch(
    
    270
    +        "os.statvfs",
    
    271
    +        autospec=True,
    
    272
    +        return_value=mock.create_autospec(
    
    273
    +            "os.statvfs_result",
    
    274
    +            f_blocks=1000,
    
    275
    +            f_bsize=10,
    
    276
    +            f_bavail=600,
    
    277
    +        )
    
    278
    +    )
    
    279
    +
    
    280
    +    cache_size_patch = mock.patch(
    
    281
    +        "buildstream._artifactcache.artifactcache.ArtifactCache.get_approximate_cache_size",
    
    282
    +        autospec=True,
    
    283
    +        return_value=0
    
    284
    +    )
    
    285
    +
    
    286
    +    with statvfs_patch, cache_size_patch:
    
    279 287
             res = cli.run(project=project, args=['workspace', 'list'])
    
    280 288
     
    
    281 289
         if success:
    



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]