Browse Source

Moved testing out of top level python path

master^2
Cefn Hoile 3 years ago
parent
commit
5c2512abe5
15 changed files with 10 additions and 12 deletions
  1. +1
    -2
      test/src/testing/__init__.py
  2. +2
    -2
      test/src/testing/adafruit_blinka.py
  3. +5
    -6
      test/src/testing/board/__init__.py
  4. +0
    -0
      test/src/testing/implementation/__init__.py
  5. +0
    -0
      test/src/testing/implementation/all/__init__.py
  6. +0
    -0
      test/src/testing/implementation/all/bitbangio.py
  7. +0
    -0
      test/src/testing/implementation/all/busio.py
  8. +1
    -1
      test/src/testing/implementation/all/digitalio.py
  9. +0
    -0
      test/src/testing/implementation/all/microcontroller.py
  10. +0
    -0
      test/src/testing/implementation/circuitpython/__init__.py
  11. +0
    -0
      test/src/testing/implementation/circuitpython/digitalio.py
  12. +0
    -0
      test/src/testing/implementation/micropython/__init__.py
  13. +0
    -0
      test/src/testing/implementation/micropython/digitalio.py
  14. +1
    -1
      test/src/testing/microcontroller/__init__.py
  15. +0
    -0
      test/src/testing/profiling/__init__.py

python/testing/__init__.py → test/src/testing/__init__.py View File

@ -1,7 +1,6 @@
# mitigate heap fragmentation issues by pre-loading major libraries
import gc
gc.collect()
import agnostic
gc.collect()
import unittest
gc.collect()
@ -37,7 +36,7 @@ def multi_choice(q, choices, defaultPos=None):
return None
def await_true(name, fun, interval=0, patience=60):
from agnostic import sleep
from adafruit_blinka.agnostic import sleep
from utime import ticks_ms, ticks_add, ticks_diff
print("Waiting {} sec until {} (CTRL+C give up)".format(patience, name))
deadline = ticks_add(ticks_ms(), int(patience * 1000))

python/testing/mcp.py → test/src/testing/adafruit_blinka.py View File

@ -9,8 +9,8 @@ class TestEnum(unittest.TestCase):
def setUp(self):
"""Create an example Enum, mocking __module__ and __qualname__"""
import mcp
class Cls(mcp.Enum):
import adafruit_blinka
class Cls(adafruit_blinka.Enum):
pass
Cls.one = Cls()
Cls.two = Cls()

python/testing/board/__init__.py → test/src/testing/board/__init__.py View File

@ -1,22 +1,21 @@
"""Configuration of testing fixtures depending on the board layout"""
import agnostic
import board
from adafruit_blinka import agnostic
if agnostic.board == "feather_m0_express":
from board import feather_m0_express
default_pin = feather_m0_express.D5
led_pin = feather_m0_express.D13
led_hardwired = True
led_inverted = False
elif agnostic.board == "feather_huzzah":
from board import feather_huzzah
from adafruit_blinka.board import feather_huzzah
default_pin = feather_huzzah.GPIO4
led_pin = feather_huzzah.GPIO0 # red led
led_hardwired = True
led_inverted = True
elif agnostic.board == "pyboard":
from board import pyboard
default_pin = pyboard.X1
led_pin = board.pyboard.LED_BLUE
led_pin = adafruit_blinka.board.pyboard.LED_BLUE
led_hardwired = True
led_inverted = False
else:

python/testing/implementation/__init__.py → test/src/testing/implementation/__init__.py View File


python/testing/implementation/all/__init__.py → test/src/testing/implementation/all/__init__.py View File


python/testing/implementation/all/bitbangio.py → test/src/testing/implementation/all/bitbangio.py View File


python/testing/implementation/all/busio.py → test/src/testing/implementation/all/busio.py View File


python/testing/implementation/all/digitalio.py → test/src/testing/implementation/all/digitalio.py View File

@ -33,7 +33,7 @@ class TestDigitalInOutInteractive(unittest.TestCase):
def test_blink(self):
"""LED blinks when proper attributes set"""
print()
from agnostic import sleep
from adafruit_blinka.agnostic import sleep
if not(led_hardwired) and not(yes_no("Is LED wired to {}".format(led_pin))):
return # test trivially passed
with DigitalInOut(led_pin) as led:

python/testing/implementation/all/microcontroller.py → test/src/testing/implementation/all/microcontroller.py View File


python/testing/implementation/circuitpython/__init__.py → test/src/testing/implementation/circuitpython/__init__.py View File


python/testing/implementation/circuitpython/digitalio.py → test/src/testing/implementation/circuitpython/digitalio.py View File


python/testing/implementation/micropython/__init__.py → test/src/testing/implementation/micropython/__init__.py View File


python/testing/implementation/micropython/digitalio.py → test/src/testing/implementation/micropython/digitalio.py View File


python/testing/microcontroller/__init__.py → test/src/testing/microcontroller/__init__.py View File

@ -1,4 +1,4 @@
from agnostic import microcontroller
from adafruit_blinka.agnostic import microcontroller
if microcontroller == "esp8266":
pin_count = 10

python/testing/profiling/__init__.py → test/src/testing/profiling/__init__.py View File


Loading…
Cancel
Save