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

Make deprecated API available for backend="win32" only #251

Merged
merged 11 commits into from
Oct 25, 2016

Conversation

vasily-v-ryabov
Copy link
Contributor

  • Enable Codacy coverage submission (the results are not aggregated by multiple runs yet).
  • Improve print_control_identifiers().
  • Make children() and descendants() process-agnostic by default (useful for Win10 Calculator example). Yes, some windows in Store apps can have children in different processes! So we could miss them even if using Desktop(backend"uia") object as a root.
  • Enable UIA tests for 32-bit Python 3.5.
  • Enable FuzzyDict tests in a separate file.

Surprisingly FuzzyDict tests are a bit unstable (2 failures in ~2 out of 8 runs).
testCheckBoxes for native TreeView is also painful area. :(

Copy link
Contributor

@airelil airelil left a comment

Choose a reason for hiding this comment

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

I didn't have too much time to review this PR. Maybe I'll take a look again tomorrow. Sorry.

@@ -556,19 +550,21 @@ def _ctrl_identifiers(self):

return control_name_map

def print_control_identifiers(self, depth = 2):
def print_control_identifiers(self, depth = None):
Copy link
Contributor

Choose a reason for hiding this comment

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

Printing the whole hierarchy by default looks a bit exaggerated for me. User might get confused with a huge number of prints spat out by the function. Maybe we could leave depth=2 but print an info before the all identifiers that there are other options if more levels are required. Something like:
"Print out identifiers for {0} levels. Use 'depth' argument to get info about deeper sub-levels".format(depth)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure user could find this message quickly even for one level of the subtree. Will leave a TODO to think about that.

'Hiya' : 1,
'hiy\xe4' : 2,
'test3' : 3,
1: 324}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think if the dictionary strings will be declared explicitly as unicode strings the search order of "test_dict" won't change between different python versions

        test_dict = {
            u'Hiya'  : 1,
            u'hiy\xe4' : 2,
            u'test3' : 3,
            1: 324}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will try, though from __future__ import unicode_literals should do the trick but it didn't.

Copy link
Contributor

Choose a reason for hiding this comment

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

I looked into fuzzydict.py today. With the given test_dict, a lookup for 'hiya' produces two equal ratio scores: 'Hiya'=0.75 and 'hia\xe4' = 0.75 thus the implementation of FuzzyDict will always have instabilities since it's based on a regular dict that has no guarantee on elements order. As an option we could consider to subclass OrderedDict but if we want to keep the insertion order this new FuzzyDict object (based on OrderedDict) must be initialized with a list and NOT with a regular dict. So instead of { u'Hiya': 1, u'hiy\xe4:2, ...} it has to be
test_dict = [ (u'Hiya', 1), (u'hiy\xe4' : 2), (u'test3' : 3), (1: 324)]
It also requires Py2.7 minimum

@codecov-io
Copy link

codecov-io commented Oct 23, 2016

Current coverage is 95.00% (diff: 86.15%)

Merging #251 into master will increase coverage by 0.30%

@@             master       #251   diff @@
==========================================
  Files            47         47          
  Lines         19205      19206     +1   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          18186      18246    +60   
+ Misses         1019        960    -59   
  Partials          0          0          

Powered by Codecov. Last update a26ffcd...b600e06

@vasily-v-ryabov vasily-v-ryabov merged commit ca771f5 into pywinauto:master Oct 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants