Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(client): fix race condition in unit test #2304

Merged
merged 1 commit into from
Jun 7, 2023

Conversation

jialeicui
Copy link
Contributor

@jialeicui jialeicui commented Jun 1, 2023

Description

https://github.com/star-whale/starwhale/actions/runs/5140825504/jobs/9252653401?pr=2302#step:8:452

_______________________ TestPytorch.test_image_transform _______________________

self = <tests.sdk.test_dataset_sdk.TestPytorch testMethod=test_image_transform>

    def setUp(self) -> None:
>       super().setUp()

tests/sdk/test_dataset_sdk.py:47: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/__init__.py:26: in setUp
    self.datastore_root = str(sw_config.SWCliConfigMixed().datastore_dir)
starwhale/utils/config.py:111: in __init__
    self._config = swcli_config or load_swcli_config()
starwhale/utils/config.py:46: in load_swcli_config
    _config = render_default_swcli_config(fpath)
starwhale/utils/config.py:86: in render_default_swcli_config
    render_swcli_config(c, fpath)
starwhale/utils/config.py:105: in render_swcli_config
    ensure_file(fpath, yaml.safe_dump(c, default_flow_style=False), mode=0o600)
starwhale/utils/fs.py:56: in ensure_file
    _tmp_f.rename(path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = PosixPath('/tmp/sw-test-mock-yjlm3t2e/.config.yaml.tmp')
target = '/tmp/sw-test-mock-yjlm3t2e/config.yaml'

    def rename(self, target):
        """
        Rename this path to the given path.
        """
        if self._closed:
            self._raise_closed()
>       self._accessor.rename(self, target)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/sw-test-mock-yjlm3t2e/.config.yaml.tmp' -> '/tmp/sw-test-mock-yjlm3t2e/config.yaml'

2023-06-06_15-11

Modules

  • UI
  • Controller
  • Agent
  • Client
  • Python-SDK
  • Others

Checklist

  • run code format and lint check
  • add unit test
  • add necessary doc

@codecov
Copy link

codecov bot commented Jun 1, 2023

Codecov Report

Merging #2304 (dccf22c) into main (a973d8f) will increase coverage by 8.35%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##               main    #2304      +/-   ##
============================================
+ Coverage     82.64%   90.99%   +8.35%     
============================================
  Files           427       98     -329     
  Lines         22621    11027   -11594     
  Branches       1308        0    -1308     
============================================
- Hits          18694    10034    -8660     
+ Misses         3340      993    -2347     
+ Partials        587        0     -587     
Flag Coverage Δ
console ?
controller ?
standalone 90.99% <100.00%> (+<0.01%) ⬆️
unittests 90.99% <100.00%> (+0.08%) ⬆️

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

Impacted Files Coverage Δ
client/starwhale/utils/fs.py 88.34% <100.00%> (+0.07%) ⬆️

... and 329 files with indirect coverage changes

@jialeicui jialeicui marked this pull request as draft June 2, 2023 10:08
@jialeicui jialeicui force-pushed the fix-ut branch 3 times, most recently from df73145 to e3fca1b Compare June 6, 2023 07:59
@jialeicui jialeicui marked this pull request as ready for review June 6, 2023 10:58
@jialeicui jialeicui requested a review from tianweidut June 6, 2023 10:59
Copy link
Member

@tianweidut tianweidut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tianweidut tianweidut merged commit c072eef into star-whale:main Jun 7, 2023
@jialeicui jialeicui deleted the fix-ut branch June 7, 2023 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working client 🌈
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants