Skip to content

bad assumption on port path in motor test #147

Closed

Description

Activity

  1. self-assigned this
    on Sep 15, 2016
  2. dwalton76 commented on Sep 1, 2017

    @dwalton76
    Collaborator

    @ddemidov @WasabiFan do either of you remember how to run the tests? I was going to work on this but I've never actually run the tests and couldn't find docs on it.

  3. WasabiFan commented on Sep 1, 2017

    @WasabiFan
    Member

    Woah, we have tests? 😆 But seriously, I think you just have to run the api_tests.py file. I'm not 100% sure they've been confirmed working since we upgraded to Python3 though.

  4. ddemidov commented on Sep 1, 2017

    @ddemidov
    Member

    We do have tests and they are run on every commit and every pull request here:
    https://travis-ci.org/rhempel/ev3dev-lang-python/builds

    The steps needed to run the tests are 'documented' here:
    https://github.com/rhempel/ev3dev-lang-python/blob/develop/.travis.yml#L8

  5. WasabiFan commented on Sep 1, 2017

    @WasabiFan
    Member

    I was joking! 😆 Well, mostly. I totally forgot we ran them in CO builds though.

  6. dwalton76 commented on Sep 1, 2017

    @dwalton76
    Collaborator

    ah I did not have fake-sys that was part of my problem. @ddemidov we create a directory called lego-sensor/sensor0 and cp the contents of /sys/class/lego-sensor/sensor0 to that directory

    $ node=lego-sensor/sensor0
    $ mkdir -p ./${node}
    $ cp -P --copy-contents -r /sys/class/${node}/* ./${node}/
    

    So this has to run on a device running ev3dev? I'm not following how we are running the tests in github on each commit unless we have an ev3dev vm that spins up to run the tests

    When I run it I get

    dwalton@laptop ~/l/e/tests> ./api_tests.py 
    	0	in1	/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/lego-sensor/sensor0
    	0	outA	/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/tacho-motor/motor0
    .	0	in1	/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/lego-sensor/sensor0
    /usr/lib/python3.5/unittest/case.py:600: ResourceWarning: unclosed file <_io.FileIO name='/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/lego-sensor/sensor0/address' mode='rb+' closefd=True>
      testMethod()
    /usr/lib/python3.5/unittest/case.py:600: ResourceWarning: unclosed file <_io.FileIO name='/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/lego-sensor/sensor0/bin_data' mode='rb+' closefd=True>
      testMethod()
    /usr/lib/python3.5/unittest/case.py:600: ResourceWarning: unclosed file <_io.FileIO name='/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/lego-sensor/sensor0/bin_data_format' mode='rb+' closefd=True>
      testMethod()
    /usr/lib/python3.5/unittest/case.py:600: ResourceWarning: unclosed file <_io.FileIO name='/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/lego-sensor/sensor0/num_values' mode='rb+' closefd=True>
      testMethod()
    /usr/lib/python3.5/unittest/case.py:600: ResourceWarning: unclosed file <_io.FileIO name='/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/lego-sensor/sensor0/value0' mode='rb+' closefd=True>
      testMethod()
    .	0	outA	/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/tacho-motor/motor0
    /usr/lib/python3.5/unittest/case.py:600: ResourceWarning: unclosed file <_io.FileIO name='/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/tacho-motor/motor0/address' mode='rb+' closefd=True>
      testMethod()
    /usr/lib/python3.5/unittest/case.py:600: ResourceWarning: unclosed file <_io.FileIO name='/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/tacho-motor/motor0/commands' mode='rb+' closefd=True>
      testMethod()
    /usr/lib/python3.5/unittest/case.py:600: ResourceWarning: unclosed file <_io.FileIO name='/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/tacho-motor/motor0/count_per_rot' mode='rb+' closefd=True>
      testMethod()
    /usr/lib/python3.5/unittest/case.py:600: ResourceWarning: unclosed file <_io.FileIO name='/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/tacho-motor/motor0/driver_name' mode='rb+' closefd=True>
      testMethod()
    /usr/lib/python3.5/unittest/case.py:600: ResourceWarning: unclosed file <_io.FileIO name='/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/tacho-motor/motor0/duty_cycle' mode='rb+' closefd=True>
      testMethod()
    /usr/lib/python3.5/unittest/case.py:600: ResourceWarning: unclosed file <_io.FileIO name='/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/tacho-motor/motor0/duty_cycle_sp' mode='rb+' closefd=True>
      testMethod()
    /usr/lib/python3.5/unittest/case.py:600: ResourceWarning: unclosed file <_io.FileIO name='/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/tacho-motor/motor0/polarity' mode='rb+' closefd=True>
      testMethod()
    /usr/lib/python3.5/unittest/case.py:600: ResourceWarning: unclosed file <_io.FileIO name='/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/tacho-motor/motor0/position' mode='rb+' closefd=True>
      testMethod()
    /usr/lib/python3.5/unittest/case.py:600: ResourceWarning: unclosed file <_io.FileIO name='/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/tacho-motor/motor0/position_sp' mode='rb+' closefd=True>
      testMethod()
    /usr/lib/python3.5/unittest/case.py:600: ResourceWarning: unclosed file <_io.FileIO name='/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/tacho-motor/motor0/ramp_down_sp' mode='rb+' closefd=True>
      testMethod()
    /usr/lib/python3.5/unittest/case.py:600: ResourceWarning: unclosed file <_io.FileIO name='/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/tacho-motor/motor0/ramp_up_sp' mode='rb+' closefd=True>
      testMethod()
    /usr/lib/python3.5/unittest/case.py:600: ResourceWarning: unclosed file <_io.FileIO name='/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/tacho-motor/motor0/speed' mode='rb+' closefd=True>
      testMethod()
    /usr/lib/python3.5/unittest/case.py:600: ResourceWarning: unclosed file <_io.FileIO name='/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/tacho-motor/motor0/speed_sp' mode='rb+' closefd=True>
      testMethod()
    /usr/lib/python3.5/unittest/case.py:600: ResourceWarning: unclosed file <_io.FileIO name='/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/tacho-motor/motor0/state' mode='rb+' closefd=True>
      testMethod()
    /usr/lib/python3.5/unittest/case.py:600: ResourceWarning: unclosed file <_io.FileIO name='/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/tacho-motor/motor0/stop_action' mode='rb+' closefd=True>
      testMethod()
    /usr/lib/python3.5/unittest/case.py:600: ResourceWarning: unclosed file <_io.FileIO name='/home/dwalton/lego/ev3dev-lang-python/tests/fake-sys/arena/tacho-motor/motor0/time_sp' mode='rb+' closefd=True>
      testMethod()
    .
    ----------------------------------------------------------------------
    Ran 3 tests in 0.015s
    
    OK
    dwalton@laptop ~/l/e/tests> 
    

    which matches up with the output from https://travis-ci.org/rhempel/ev3dev-lang-python/builds/270811841

    Just trying to get my head wrapped around how this works (or is supposed to work)

  7. ddemidov commented on Sep 1, 2017

    @ddemidov
    Member

    The tests do not need to be run on the EV3. We create a fake filesystem that contains device attributes, and use that to test our IO functions. This is not ideal, but allows us to use continuous integration services like Travis-CI. See more here:

  8. dwalton76 commented on Sep 2, 2017

    @dwalton76
    Collaborator

    My confusion is around these instructions in the README of the test directory

    node=lego-sensor/sensor0
    mkdir -p ./${node}
    cp -P --copy-contents -r /sys/class/${node}/* ./${node}/
    

    which on a non ev3dev machine leaves you with

    dwalton@laptop ~/l/e/tests> tree lego-sensor/
    lego-sensor/
    └── sensor0
    
    1 directory, 0 files
    dwalton@laptop ~/l/e/tests>
    

    I renamed that lego-sensor directory to garbage and re-ran api_tests.py and got the same results. It seems that the README should say something like

    - Make sure you have the fake-sys directory, if not do XYZ to get it
    - run api_test.py
    

    Is the copied lego-sensor directory (assuming you ran this on ev3dev) what was used before the days of fake-sys?

  9. WasabiFan commented on Sep 2, 2017

    @WasabiFan
    Member

    We just used the README to take notes for future documentation purposes on one part of the process, you don't actually have to run those commands. See the message above them:

    Commands used to copy the /sys/class node:

    The submodule contains the data already.

  10. dwalton76 commented on Sep 7, 2017

    @dwalton76
    Collaborator

    fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions