parent
931e9bdbe4
commit
926c87c0e2
@ -0,0 +1,23 @@
|
||||
/* Copyright 2019
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
#define MATRIX_COL_PINS { A3 }
|
||||
#define MATRIX_ROW_PINS { A2 }
|
||||
#define UNUSED_PINS
|
@ -0,0 +1,3 @@
|
||||
# PyTest onekey
|
||||
|
||||
This is used by the python test framework. It's probably not useful otherwise.
|
@ -0,0 +1,2 @@
|
||||
# MCU name
|
||||
MCU = STM32F303
|
@ -0,0 +1 @@
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {__KEYMAP_GOES_HERE__};
|
@ -0,0 +1,18 @@
|
||||
"""QMK Python Unit Tests
|
||||
|
||||
QMK script to run unit and integration tests against our python code.
|
||||
"""
|
||||
from milc import cli
|
||||
|
||||
|
||||
@cli.entrypoint('QMK Python Unit Tests')
|
||||
def main(cli):
|
||||
"""Use nose2 to run unittests
|
||||
"""
|
||||
try:
|
||||
import nose2
|
||||
except ImportError:
|
||||
cli.log.error('Could not import nose2! Please install it with {fg_cyan}pip3 install nose2')
|
||||
return False
|
||||
|
||||
nose2.discover()
|
@ -0,0 +1,8 @@
|
||||
class AttrDict(dict):
|
||||
"""A dictionary that can be accessed by attributes.
|
||||
|
||||
This should only be used to mock objects for unit testing. Please do not use this outside of qmk.tests.
|
||||
"""
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(AttrDict, self).__init__(*args, **kwargs)
|
||||
self.__dict__ = self
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"keyboard":"handwired/onekey/pytest",
|
||||
"keymap":"pytest_unittest",
|
||||
"layout":"LAYOUT",
|
||||
"layers":[["KC_A"]]
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
from qmk.errors import NoSuchKeyboardError
|
||||
|
||||
def test_NoSuchKeyboardError():
|
||||
try:
|
||||
raise(NoSuchKeyboardError("test message"))
|
||||
except NoSuchKeyboardError as e:
|
||||
assert e.message == 'test message'
|
@ -0,0 +1,18 @@
|
||||
import qmk.keymap
|
||||
|
||||
def test_template_onekey_proton_c():
|
||||
templ = qmk.keymap.template('handwired/onekey/proton_c')
|
||||
assert templ == qmk.keymap.DEFAULT_KEYMAP_C
|
||||
|
||||
|
||||
def test_template_onekey_pytest():
|
||||
templ = qmk.keymap.template('handwired/onekey/pytest')
|
||||
assert templ == 'const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {__KEYMAP_GOES_HERE__};\n'
|
||||
|
||||
|
||||
def test_generate_onekey_pytest():
|
||||
templ = qmk.keymap.generate('handwired/onekey/pytest', 'LAYOUT', [['KC_A']])
|
||||
assert templ == 'const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT(KC_A)};\n'
|
||||
|
||||
|
||||
# FIXME(skullydazed): Add a test for qmk.keymap.write that mocks up an FD.
|
@ -0,0 +1,12 @@
|
||||
import os
|
||||
|
||||
import qmk.path
|
||||
|
||||
def test_keymap_onekey_pytest():
|
||||
path = qmk.path.keymap('handwired/onekey/pytest')
|
||||
assert path == 'keyboards/handwired/onekey/keymaps'
|
||||
|
||||
|
||||
def test_normpath():
|
||||
path = qmk.path.normpath('lib/python')
|
||||
assert path == os.environ['ORIG_CWD'] + '/lib/python'
|
Loading…
Reference in new issue