Skip to content

Conversation

@bernhardkaindl
Copy link
Contributor

Test, cover (and fix the method writeFile()) of subclasses of xcp.accessor.MountingAccessor:

Add test cases testing the methods openAddress(), access()
and writeFile() of subclasses of xcp.accessor.MountingAccessor.

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com>
Add a typing stub for pyfakefs to avoid having to disable
type checking for pyfakefs in tests/test_mountingaccessor.py
which uses it to simulate reading and writing arbitrary files.

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com>
Fix MountingAccessor.writeFile() for binary files as checked by
the new test in tests/test_mountingaccessor.py: check_binary_write()

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com>
Fix static analysis warnings in `MountingAccessor` by checking
`self.location` to not be `None` before accessing it:

- MountingAccessor's self.location changes between `str` and `None`
  depending on the state of the MountingAccessor object (initialized,
  started, stopped/finished). The assert lets checkers know it is str
  when it is used in these locations.

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com>
@codecov
Copy link

codecov bot commented Jun 9, 2023

Codecov Report

Merging #75 (07d5abd) into master (70b4531) will increase coverage by 2.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #75      +/-   ##
==========================================
+ Coverage   75.56%   77.59%   +2.03%     
==========================================
  Files          21       21              
  Lines        3466     3468       +2     
==========================================
+ Hits         2619     2691      +72     
+ Misses        847      777      -70     
Flag Coverage Δ
unittest 77.59% <100.00%> (+2.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
xcp/accessor.py 86.19% <100.00%> (+19.27%) ⬆️

... and 2 files with indirect coverage changes

@bernhardkaindl bernhardkaindl merged commit 6e930d1 into xenserver:master Jun 9, 2023
@bernhardkaindl bernhardkaindl deleted the fix-MountingAccessor-writeFile branch September 26, 2025 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants