Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
ccc1d88
Try and fix some more pychecker issues
peternewman May 30, 2016
bc90399
Fix a flake8 warning
peternewman May 30, 2016
bcd2c1c
Merge branch 'master' into pychecker
peternewman May 30, 2016
e987bcf
Run the test regardless if we just don't know the max scene number
peternewman Jun 1, 2016
0abb8d5
Make the PRESET_STATUS checks more generic
peternewman Jun 1, 2016
04b0b52
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman Jun 1, 2016
e34f2a0
Merge branch 'pychecker' of https://github.com/peternewman/ola into p…
peternewman Jun 1, 2016
aa31a0d
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman Jun 1, 2016
74a0346
Merge branch 'master' into pychecker
peternewman Aug 18, 2016
ba9c9fb
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman Aug 19, 2016
0f412bf
Merge branch 'pychecker' of https://github.com/peternewman/ola into p…
peternewman Aug 19, 2016
58e47f7
Fix a flake8 issue
peternewman Aug 19, 2016
2726354
Fix some more pychecker issues
peternewman Aug 19, 2016
de02c33
Fix more Pychecker issues
peternewman Aug 19, 2016
17c6961
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman Aug 19, 2016
abe6d6d
Fix a flake8 issue
peternewman Aug 19, 2016
d4f9cfd
Fix another pychecker bug
peternewman Aug 19, 2016
dfd1dcf
Try and broaden the scope of the main pychecker run
peternewman Aug 19, 2016
f3bf80a
Correctly broaden the scope of the main pychecker run
peternewman Aug 19, 2016
0d3a2e7
Run more restricted checking for files that import files that break p…
peternewman Aug 19, 2016
913414e
Standardise some more RDM tests
peternewman Aug 19, 2016
841d201
Check some more python files using the more restrictive pychecker
peternewman Aug 19, 2016
1528314
More RDM test improvements, more pychecker fixes
peternewman Aug 24, 2016
4d58cc4
More pychecker improvements
peternewman Aug 24, 2016
eae11cd
Be consistent with which PID name we use, remove some duplication of …
peternewman Aug 24, 2016
4717908
Remove some more duplication
peternewman Aug 24, 2016
5384c9d
Fix the flake8 issues
peternewman Aug 24, 2016
66878a7
Fix more pychecker issues
peternewman Aug 24, 2016
c737e13
Better catch some SetBroken behaviour
peternewman Aug 24, 2016
8c085bf
More pychecker work
peternewman Aug 25, 2016
b197bf4
More pychecker fixes
peternewman Aug 25, 2016
5af772b
More pychecker fixes
peternewman Aug 25, 2016
e1c9551
Fix the tests I broke and some minor output tidying
peternewman Aug 25, 2016
bfd82ab
Fix a flake8 issue
peternewman Aug 25, 2016
c7c8c67
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman Aug 27, 2016
1742383
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman Aug 28, 2016
46477bd
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman Sep 5, 2016
5fb91a1
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman Sep 9, 2016
1ad418d
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman Sep 26, 2016
534dbb4
Fix a broken merge
peternewman Sep 26, 2016
450b818
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman Sep 29, 2016
903abc2
Merge branch 'master' into pychecker
peternewman Oct 20, 2016
7bc7b77
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman Oct 21, 2016
1bc42ec
Merge branch 'pychecker' of https://github.com/peternewman/ola into p…
peternewman Oct 21, 2016
77906aa
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman Oct 23, 2016
e4f3968
Merge branch 'master' of https://github.com/OpenLightingProject/ola i…
peternewman Oct 24, 2016
5f820fc
Merge branch 'master' into pychecker
peternewman Nov 2, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ elif [[ $TASK = 'pychecker' ]]; then
mkdir ./python/ola/testing/
ln -s ./tools/rdm ./python/ola/testing/rdm
pychecker --quiet --limit 500 --blacklist $PYCHECKER_BLACKLIST $(find ./ -name "*.py" -and \( -wholename "./data/*" -or -wholename "./include/*" -or -wholename "./scripts/*" -or -wholename "./python/examples/rdm_compare.py" -or -wholename "./python/ola/*" \) -and ! \( -name "*_pb2.py" -or -name "OlaClient.py" -or -name "ola_candidate_ports.py" -or -wholename "./scripts/enforce_licence.py" -or -wholename "./python/ola/rpc/*" -or -wholename "./python/ola/ClientWrapper.py" -or -wholename "./python/ola/PidStore.py" -or -wholename "./python/ola/RDMAPI.py" \) | xargs)
# More restricted checking for files that import files that break pychecker
pychecker --quiet --limit 500 --blacklist $PYCHECKER_BLACKLIST --only $(find ./ -name "*.py" -and \( -wholename "./tools/rdm/ModelCollector.py" -or -wholename "./tools/rdm/DMXSender.py" -or -wholename "./tools/rdm/TestCategory.py" -or -wholename "./tools/rdm/TestHelpers.py" -or -wholename "./tools/rdm/TestState.py" -or -wholename "./tools/rdm/TimingStats.py" \) | xargs)
elif [[ $TASK = 'pychecker-wip' ]]; then
autoreconf -i;
./configure --enable-rdm-tests
Expand Down
2 changes: 1 addition & 1 deletion python/examples/rdm_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def _SetNextUID(self):
self._NextState()

def _NextState(self):
"""Move to the next state of information fetching."""
"""Move to the next state of information setting."""
if self.work_state == self.DMX_START_ADDRESS:
address = self.configuration[self.uid].get('dmx_start_address')
self.work_state = self.DEVICE_LABEL
Expand Down
7 changes: 7 additions & 0 deletions tools/rdm/ResponderTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class UndeclaredPropertyException(Error):

class TestFixture(object):
"""The base responder test class, every test inherits from this."""
PID = None
CATEGORY = TestCategory.UNCLASSIFIED
DEPS = []
PROVIDES = []
Expand Down Expand Up @@ -272,9 +273,14 @@ def SleepAfterBroadcastSet(self):

def Run(self):
"""Call the test method and then start running the loop wrapper."""
# Try and fail early
if self.state == TestState.BROKEN:
return

# the super call invokes self.Test()
super(ResponderTestFixture, self).Run()

# Check if we've broken during self.Test()
if self.state == TestState.BROKEN:
return

Expand All @@ -290,6 +296,7 @@ def VerifyResult(self, status, fields):
pass

def ResetState(self):
"""A hook to reset the responder after the test has run."""
pass

def Stop(self):
Expand Down
45 changes: 14 additions & 31 deletions tools/rdm/TestDefinitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
from ola.UID import UID
from TestHelpers import ContainsUnprintable
import TestMixins
from TestMixins import MAX_DMX_ADDRESS

'''This defines all the tests for RDM responders.'''

Expand Down Expand Up @@ -549,7 +548,7 @@ def VerifyResult(self, unused_response, fields):
self.SetPropertyFromDict(fields, property_name)

footprint = fields['dmx_footprint']
if footprint > MAX_DMX_ADDRESS:
if footprint > TestMixins.MAX_DMX_ADDRESS:
self.AddWarning('DMX Footprint of %d, was more than 512' % footprint)
if footprint > 0:
personality_count = fields['personality_count']
Expand All @@ -566,7 +565,7 @@ def VerifyResult(self, unused_response, fields):

start_address = fields['dmx_start_address']
if (start_address == 0 or
(start_address > MAX_DMX_ADDRESS and
(start_address > TestMixins.MAX_DMX_ADDRESS and
start_address != RDM_ZERO_FOOTPRINT_DMX_ADDRESS)):
self.AddWarning('Invalid DMX address %d in DEVICE_INFO' % start_address)

Expand Down Expand Up @@ -1046,7 +1045,7 @@ def Test(self):

# Parameter Description
# -----------------------------------------------------------------------------
class GetParamDescription(ResponderTestFixture):
class GetParamDescription(ParamDescriptionTestFixture):
"""Check that GET parameter description works for any manufacturer params."""
CATEGORY = TestCategory.RDM_INFORMATION
PID = 'PARAMETER_DESCRIPTION'
Expand All @@ -1056,6 +1055,7 @@ def Test(self):
self.params = self.Property('manufacturer_parameters')[:]
if len(self.params) == 0:
self.SetNotRun('No manufacturer params found')
# This case is tested in GetParamDescriptionForNonManufacturerPid
return
self._GetParam()

Expand Down Expand Up @@ -1092,7 +1092,7 @@ def VerifyResult(self, response, fields):
(self.pid.name, fields['description'].encode('string-escape')))


class GetParamDescriptionForNonManufacturerPid(ResponderTestFixture):
class GetParamDescriptionForNonManufacturerPid(ParamDescriptionTestFixture):
"""GET parameter description for a non-manufacturer pid."""
CATEGORY = TestCategory.ERROR_CONDITIONS
PID = 'PARAMETER_DESCRIPTION'
Expand All @@ -1114,7 +1114,8 @@ def Test(self):
self.SendGet(ROOT_DEVICE, self.pid, [device_info_pid.value])


class GetParamDescriptionWithExtraData(ResponderTestFixture):
class GetParamDescriptionWithExtraData(TestMixins.GetWithDataMixin,
ParamDescriptionTestFixture):
"""GET parameter description with extra param data."""
PID = 'PARAMETER_DESCRIPTION'
REQUIRES = ['manufacturer_parameters']
Expand All @@ -1130,7 +1131,7 @@ def Test(self):
if self.Property('manufacturer_parameters'):
results = self.NackGetResult(RDMNack.NR_FORMAT_ERROR)
self.AddExpectedResults(results)
self.SendRawGet(ROOT_DEVICE, self.pid, 'foo')
self.SendRawGet(ROOT_DEVICE, self.pid, self.DATA)


class SetParamDescription(TestMixins.UnsupportedSetMixin,
Expand Down Expand Up @@ -2197,7 +2198,7 @@ def Test(self):
self.NackSetResult(RDMNack.NR_UNSUPPORTED_COMMAND_CLASS),
self.NackSetResult(RDMNack.NR_DATA_OUT_OF_RANGE)
])
data = struct.pack('!H', MAX_DMX_ADDRESS + 1)
data = struct.pack('!H', TestMixins.MAX_DMX_ADDRESS + 1)
self.SendRawSet(ROOT_DEVICE, self.pid, data)


Expand Down Expand Up @@ -2692,10 +2693,6 @@ class GetSensorDefinitionWithExtraData(TestMixins.GetWithDataMixin,
"""Get the sensor definition with more than 1 byte of data."""
PID = 'SENSOR_DEFINITION'

def Test(self):
self.AddIfGetSupported(self.NackGetResult(RDMNack.NR_FORMAT_ERROR))
self.SendRawGet(ROOT_DEVICE, self.pid, self.DATA)


class GetInvalidSensorDefinition(OptionalParameterTestFixture):
"""Get the sensor definition with the all sensor value (0xff)."""
Expand Down Expand Up @@ -2963,13 +2960,7 @@ class ResetSensorValueWithNoData(TestMixins.SetWithNoDataMixin,
OptionalParameterTestFixture):
"""SET sensor value without any sensor number."""
PID = 'SENSOR_VALUE'

def Test(self):
self.AddIfSetSupported([
self.NackSetResult(RDMNack.NR_FORMAT_ERROR),
self.NackSetResult(RDMNack.NR_UNSUPPORTED_COMMAND_CLASS),
])
self.SendRawSet(ROOT_DEVICE, self.pid, '')
ALLOWED_NACKS = [RDMNack.NR_UNSUPPORTED_COMMAND_CLASS]


class AllSubDevicesGetSensorValue(TestMixins.AllSubDevicesGetMixin,
Expand Down Expand Up @@ -3906,14 +3897,6 @@ def NewValue(self):
length = len(GetPowerState.ALLOWED_STATES)
return GetPowerState.ALLOWED_STATES[(old_value + 1) % length]

def ResetState(self):
if not self.OldValue():
return

# Reset back to the old value
self.SendSet(ROOT_DEVICE, self.pid, [self.OldValue()])
self._wrapper.Run()


class SetPowerStateWithNoData(TestMixins.SetWithNoDataMixin,
OptionalParameterTestFixture):
Expand Down Expand Up @@ -4260,11 +4243,11 @@ def VerifyResult(self, response, fields):
footprint = fields['sub_device_footprint']
base_address = fields['base_dmx_address']

if footprint > MAX_DMX_ADDRESS:
if footprint > TestMixins.MAX_DMX_ADDRESS:
self.AddWarning('Sub device footprint > 512, was %d' % footprint)

if (base_address == 0 or
(base_address > MAX_DMX_ADDRESS and
(base_address > TestMixins.MAX_DMX_ADDRESS and
base_address != self.NON_CONTIGUOUS)):
self.AddWarning('Base DMX address is outside range 1-512, was %d' %
base_address)
Expand Down Expand Up @@ -4341,7 +4324,7 @@ def NewValue(self):
return 1

new_address = base_address + 1
if new_address + footprint > MAX_DMX_ADDRESS:
if new_address + footprint > TestMixins.MAX_DMX_ADDRESS:
new_address = 1
return new_address

Expand All @@ -4365,7 +4348,7 @@ class SetOutOfRangeDMXBlockAddress(OptionalParameterTestFixture):

def Test(self):
self.AddIfSetSupported(self.NackSetResult(RDMNack.NR_DATA_OUT_OF_RANGE))
data = struct.pack('!H', MAX_DMX_ADDRESS + 1)
data = struct.pack('!H', TestMixins.MAX_DMX_ADDRESS + 1)
self.SendRawSet(ROOT_DEVICE, self.pid, data)


Expand Down
Loading