Commit Graph

28 Commits

Author SHA1 Message Date
Dave Jones
c820636fcb Fix #279 once and for all (ha! ;)
This implements the proposal discussed in the re-opened #279 to add a
pin_factory argument at the device level and remove the ability to
specify a pin instance to device constructors (they now only accept a
pin specification).

Note: there's still a couple of bits to tidy up (tests on "real" Pis,
and pin_factory.release_all needs refinement) but the test suite is now
at least capable of passing on a PC.
2017-07-04 00:26:41 +01:00
Dave Jones
56f2152daf Change CompositeDevice to reject invalid identifiers
Also updated StatusBoard and StatusZero to reject duplicate identifiers
(namedtuple doesn't pick 'em up because they're passed in a dict and
thus the dups are squashed prior to the call). Added tests for all the
relevant stuff.
2017-06-25 20:44:13 +01:00
Dave Jones
c9857d55ce Fix statusboard tests
No point testing for invalid names (as they're not *really* invalid);
also ensure tests requiring PWM using MockPWMPin
2017-06-23 23:02:58 +01:00
Ben Nuttall
83cf4cada5 Add tests for StatusZero and StatusBoard 2017-06-23 22:59:29 +01:00
Dave Jones
a99e0746c3 Fix #279
Permit replacement of pin_factory without closing old factory. However,
continue closing devices associated with extant pin factory at script
termination.
2017-06-22 22:45:00 +01:00
Dave Jones
2495939603 Fix real pin tests ... and some other bits
The real pin tests were broken by the new factory stuff. This commit
fixes them up, and fixes up a few other bits besides (like why the
pigpio PWM tests were failing, why RPi.GPIO sometimes segfaulted on PWM
tests, etc.)

It also causes the real pin tests to run against MockPin (thanks to
@lurch for the suggestion!). This required some tweaks to MockPin to
make it emulate physically pulled up pins itself (which in turn
necessitated changing quite a few pin numbers in the main test suite
because we were using 2 and 3 everywhere), and to allow one MockPin to
drive another. Anyway, everything's working now including all the tests
on a Pi (haven't tried RPIO yet, but only because I'm on a Pi3 -
everything else works with overall coverage of 88% :).
2017-06-16 13:28:55 +01:00
Dave Jones
4049ef5094 Work around for longer object lifetimes on pypy
On pypy the subordinate LED objects in RGBLED composite objects do die
on failed construction ... eventually. Unfortunately it's not quick
enough to prevent the following tests from failing. As we can't know for
certain exactly which test is going to follow, it's best to simply clear
down the reservation table before each test.
2017-06-16 13:28:55 +01:00
Dave Jones
ce6217c14f Fix #459 - properly support remote SPI with pigpio
Sorry! Dave's messing around with the pin implementations again.
Hopefully the last time. The pin_factory is now really a factory object
which can be asked to produce individual pins or pin-based interfaces
like SPI (which can be supported properly via pigpio).
2017-06-16 13:28:55 +01:00
Ben Nuttall
a79f8ccc16 Merge pull request #446 from lurch/traffic_lights_tweak
Add extra TrafficLight tests, and remove the redundant setattr function
2016-09-19 14:13:51 +01:00
Andrew Scheller
1b3e6a429b Add extra TrafficLight tests, and remove the redundant setattr function
- `CompositeDevice`s can't have any of their attributes set anyway
2016-09-19 12:00:38 +01:00
Andrew Scheller
c35741c793 Add support for the Pi-Stop Traffic-light board 2016-09-19 01:11:29 +01:00
Andrew Scheller
f96ab609e2 TrafficLights.value also reports 'yellow' instead of 'amber' when appropriate 2016-06-10 12:44:39 +01:00
Andrew Scheller
38262a125f Add 'yellow' as an alias of 'amber' for TrafficLights
Fixes #345
2016-06-10 12:43:22 +01:00
Andrew Scheller
b3035d306e Add value-setter for Robot class
Fixes #305
2016-05-28 13:50:47 +01:00
Andrew Scheller
e832cfeb23 Add extra init-method params
adds `initial_value` to PiLiter, TrafficLights, PiTraffic & SnowPi and
adds `pwm` to PiTraffic
2016-05-28 12:17:52 +01:00
Andrew Scheller
3a7acbf89d Add LedBorg as a subclass of RGBLED 2016-05-26 20:27:16 +01:00
Andrew Scheller
eaf0d5ce1e Add tests for LEDBoard.active_high and LEDBarGraph.active_high
Also add LEDBoard.value tests
2016-05-10 11:53:36 +01:00
Dave Jones
fd4075835e Mark optional sleeps with no coverage
Codecov frequently whinges about "unexpected coverage changes" on PRs;
this is because the sleep lines affected sometimes execute and sometimes
don't (they're only there to ensure something exists before we test it).
Hopefully codecov notices the pragmas...
2016-05-09 11:10:31 +01:00
Dave Jones
afc847c159 Merge pull request #307 from lurch/extra_board_tests
Add more unit tests, fix a few small bugs
2016-05-08 11:36:27 +01:00
Andrew Scheller
fddb95b84b Add more unit tests, fix a few small bugs 2016-04-30 16:47:29 +01:00
Andrew Scheller
864c4f9327 test Energenie repr 2016-04-30 14:12:51 +01:00
Andrew Scheller
28afa63ba8 test tweak 2016-04-30 12:24:05 +01:00
Dave Jones
79a0fd2a27 Fix #278
Allow the creation of remote pins easily with PiGPIOPin. Also changes
DefaultPin to a pin_factory callable which accepts the input pin number.
2016-04-16 00:30:22 +01:00
Dave Jones
c2a9392ea5 Make tests work reliably on the Pi
While the tests work well on a PC or Travis, the Pi (where I ought to be
running them!) has some issues with the timing tests. Need to relax the
tolerance of the "assert_states_and_times" method to 0.05 seconds
otherwise it periodically fails even on something reasonably quick like
a Pi 2 (less failures on a Pi 3 but still occasionally).

Also reduced default fps to 25; if the default timing occasionally fails
on a Pi 2 it's evidently too fast for a Pi 1 and shouldn't be the
default; 25 also doesn't look any different to me on a pulsing LED.

There's also a bunch of miscellaneous fixes in here; last minute typos
and chart re-gens for the 1.2 release.
2016-04-08 23:11:14 +01:00
Dave Jones
dc79671b39 Dsiable control_all test on pypy
Timing too random as usual...
2016-04-06 23:20:55 +01:00
Dave Jones
ee3bd6b532 Fix #204 and start readying the release
Also re-numbers energenie sockets 1-4 (as noted by @bennuttall in
comments to #239), and adds several "real pins" tests and board tests.
The bad-PWM stuff is currently disabled as it causes segfaults when
running the tests and I can't seem to trace the cause at the moment.
Finally, I've tweaked the deb config to suggest gpiozero, removed spidev
as a mandatory dep (which'll fix installs on wheezy for py3), and
there's some more miscellaneous last-minute stuff here that I can't
recall...
2016-04-06 23:06:46 +01:00
Andrew Scheller
c0d70f35f6 MockPin improvements
Change MockPin (and MockPWMPin) to make them behave more like 'real' pins - fixes #206
Add new MockPin tests, and rework some of the existing ones
Incorporate #216
2016-02-21 00:35:01 +00:00
Dave Jones
1f2140a9f5 Work on #87
Implement a test suite, including Travis-CI integration
2016-02-11 21:11:22 +00:00