Added code to set_v and set_i to check if the Sink gave any error
message when running those commands, raising exceptions if it did.
This makes two of the three new tests pass. The other one will need
support from the Sink itself, which currently doesn't care if the
voltage is over 20 V or the current is over 5 A. That is to say that
the third test will automatically start passing if the Sink is running
firmware 1.0.1, which is yet to be released.
Added three new tests: test_set_tmpcfg_huge, test_set_tmpcfg_big, and
test_set_tmpcfg_neg. They set temporary configurations with huge
(> UINT16_MAX), big (> 20 V, > 5 A), and negative voltages and currents,
respectively. These tests all fail currently, so I'll work on making
them pass.
Testing info in README, wider Python compatibility
The library has now been tested with Python 2.7, 3.3, 3.4, 3.5, and 3.6.
The README and setup.py now indicate this. The README also says how to
run the tests, and that you need a PD Buddy Sink plugged in for them to
be completely thorough.
Before, we sent ^D, but didn't read past the prompt that appeared. This
put us one command behind the most recent, causing all manner of mayhem.
It's all fixed now I believe, but this really shows the need for unit
testing. I'm working on that.
This removes any garbage that the Sink may have in its buffer, e.g.
partially entered commands or nonsense that appeared when moving the
device to/from a VM.
One extra dependency is pulled in for Python versions older than 3.6,
but other than that it's pretty easy to support them. It definitely
works on 2.7 now, and should work on older 3.x versions (but that's
untested).
Now the port is not part of the API, there's a method to close it,
__init__ can take a string in addition to the objects it used to take,
and the class is a context manager for the with statement. I can
confidently say that these are all great changes.
The timeout was a dirty hack from the start. It was long enough that
commands have finished running by the time it completes, but it wasn't
the right way to see when a command finished running. The right way is
to look for the PDBS) prompt, which is what we do now.
This makes the Sink.set_tmpcfg method run noticeably faster. Neat.