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

Less verbose reprs for descriptors #1579

Merged
merged 1 commit into from
Nov 8, 2022

Conversation

rytilahti
Copy link
Owner

Makes reading logs easier.

@codecov-commenter
Copy link

codecov-commenter commented Nov 8, 2022

Codecov Report

Merging #1579 (4b1c9e9) into master (0797fc2) will decrease coverage by 0.39%.
The diff coverage is 11.49%.

@@            Coverage Diff             @@
##           master    #1579      +/-   ##
==========================================
- Coverage   81.27%   80.87%   -0.40%     
==========================================
  Files         155      156       +1     
  Lines       15176    15250      +74     
  Branches     3274     3283       +9     
==========================================
  Hits        12334    12334              
- Misses       2593     2667      +74     
  Partials      249      249              
Impacted Files Coverage Δ
miio/devtools/simulators/miotsimulator.py 0.00% <0.00%> (ø)
miio/miot_cloud.py 0.00% <0.00%> (ø)
miio/descriptors.py 96.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@rytilahti
Copy link
Owner Author

For some reason timedelta(hours=1) on datetime.now() does not change the date properly, so the tests will fail if run between 12am and 1am...

self = <DummyViomiDishwasher: 192.0.2.1 (token: ffffffffffffffffffffffffffffffff)>, time = FakeDatetime(2022, 11, 8, 0, 57), program = <Program.Quick: 2>

    @command(
        click.argument("time", type=click.DateTime(formats=["%H:%M"])),
        click.argument("program", type=EnumType(Program)),
    )
    def schedule(self, time: datetime, program: Program) -> str:
        """Schedule a program run.
    
        *time* defines the time when the program should finish.
        """
    
        if program == Program.Unknown:
            ValueError(f"Program {program.name} is not valid for this function.")
    
        now = datetime.now()
        scheduled_finish_date = now.replace(
            hour=time.hour, minute=time.minute, second=0, microsecond=0
        )
        scheduled_start_date = scheduled_finish_date - timedelta(
            seconds=program.run_time
        )
        if scheduled_start_date < now:
>           raise ValueError(
                f"Proposed time ({scheduled_start_date} < {now}) is in the past (the proposed time is the finishing time, not the start time)."
            )
E           ValueError: Proposed time (2022-11-07 00:29:05 < 2022-11-07 23:57:53.324466) is in the past (the proposed time is the finishing time, not the start time).

miio/integrations/viomidishwasher/viomidishwasher.py:336: ValueError

@rytilahti rytilahti merged commit db60ac1 into master Nov 8, 2022
@rytilahti rytilahti deleted the fix/decrease_descriptor_verbosity branch November 8, 2022 00:16
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.

2 participants