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

AMI430 test: fix flakiness from asserting timestamps of Parameters #1718

Merged
merged 2 commits into from
Sep 13, 2019

Conversation

astafan8
Copy link
Contributor

@astafan8 astafan8 commented Sep 13, 2019

The Parameter uses datetime.now() to define a timestamp of when it's value was set. datetime.now() may not always provide good resolution, so adding a time.sleep to the test code is a quick solution for the flakiness.

@astafan8 astafan8 changed the title Fix flaky tests that assert timestamps of Parameters AMI430 test: fix flakiness from asserting timestamps of Parameters Sep 13, 2019
@astafan8 astafan8 marked this pull request as ready for review September 13, 2019 10:50
@codecov
Copy link

codecov bot commented Sep 13, 2019

Codecov Report

Merging #1718 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1718   +/-   ##
=======================================
  Coverage   67.21%   67.21%           
=======================================
  Files         145      145           
  Lines       17951    17951           
=======================================
  Hits        12066    12066           
  Misses       5885     5885

@jenshnielsen
Copy link
Collaborator

jenshnielsen commented Sep 13, 2019

I agree. In principle 0.1 s should be more than enough On windows I get:

In [6]: time.get_clock_info('time')
Out[6]: namespace(adjustable=True, implementation='GetSystemTimeAsFileTime()', monotonic=False, resolution=0.015625)

@astafan8
Copy link
Contributor Author

@jenshnielsen shall i used then time.get_clock_info('time').resolution instead of a number? :)

@jenshnielsen
Copy link
Collaborator

Yes as I understand the docs here that is the time resolution used https://docs.python.org/3/library/datetime.html#datetime.datetime.now To be save i would do 2*time.get_clock_info('time').resolution or some such thing?

@astafan8
Copy link
Contributor Author

@jenshnielsen 2*time.get_clock_info('time').resolution - magnifico! thanks!

Copy link
Collaborator

@jenshnielsen jenshnielsen left a comment

Choose a reason for hiding this comment

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

Great

@astafan8 astafan8 merged commit df0b82b into master Sep 13, 2019
@astafan8 astafan8 deleted the ami430-test-timestamp-flaky branch September 13, 2019 12:18
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