google / mobly

E2E test framework for tests with complex environment requirements.
https://github.com/google/mobly
Apache License 2.0
647 stars 179 forks source link

Undefined name: Error() --> Exception() #548

Closed cclauss closed 5 years ago

cclauss commented 5 years ago

Error() is an undefined name in this context so this PR recommends using Exception() in its place.

flake8 testing of https://github.com/google/mobly on Python 3.7.1

$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics

./mobly/records.py:233:32: F821 undefined name 'unicode'
                self.details = unicode(content)
                               ^
./mobly/controllers/monsoon.py:58:15: F821 undefined name 'Error'
        raise Error('No valid config found in: %s' % configs)
              ^
./mobly/controllers/monsoon.py:529:23: F821 undefined name 'voltage'
        voltage = int(voltage[:-1])
                      ^
./mobly/controllers/monsoon.py:693:34: F821 undefined name 'mon'
            self.mon.RampVoltage(mon.start_voltage, volt)
                                 ^
./tests/mobly/controllers/android_device_test.py:632:13: F821 undefined name 'assertIs'
            assertIs(e, expected_e)
            ^
5     F821 undefined name 'Error'
5

This change is Reviewable