diff --git a/.copier-answers.yml b/.copier-answers.yml index e33f247afd..6e9eeb289e 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Do NOT update manually; changes here will be overwritten by Copier -_commit: v1.14.2 +_commit: v1.15.0 _src_path: gh:oca/oca-addons-repo-template ci: GitHub dependency_installation_mode: PIP @@ -11,6 +11,7 @@ github_enable_makepot: true github_enable_stale_action: true github_enforce_dev_status_compatibility: true include_wkhtmltopdf: true +odoo_test_flavor: OCB odoo_version: 12.0 org_name: Odoo Community Association (OCA) org_slug: OCA diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index f86d418269..6d54b60f45 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -13,7 +13,7 @@ jobs: pre-commit: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions/setup-python@v2 with: python-version: "3.6" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 20bf055d40..ba6443d81e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest name: Detect unreleased dependencies steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: | for reqfile in requirements.txt test-requirements.txt ; do if [ -f ${reqfile} ] ; then @@ -35,11 +35,9 @@ jobs: fail-fast: false matrix: include: - - container: ghcr.io/oca/oca-ci/py3.6-odoo12.0:latest - makepot: "true" - name: test with Odoo - container: ghcr.io/oca/oca-ci/py3.6-ocb12.0:latest name: test with OCB + makepot: "true" services: postgres: image: postgres:9.6 @@ -50,7 +48,7 @@ jobs: ports: - 5432:5432 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: persist-credentials: false - name: Install addons and dependencies diff --git a/hw_telium_payment_terminal/test-scripts/telium-test.py b/hw_telium_payment_terminal/test-scripts/telium-test.py index f0e7f101c9..397062a4b3 100755 --- a/hw_telium_payment_terminal/test-scripts/telium-test.py +++ b/hw_telium_payment_terminal/test-scripts/telium-test.py @@ -4,7 +4,8 @@ import curses.ascii import time import pycountry - +import logging +logger = logging.getLogger(__name__) DEVICE = '/dev/ttyACM0' DEVICE_RATE = 9600 @@ -27,7 +28,7 @@ def initialize_msg(serial): if get_one_byte_answer(serial, 'ACK'): return True else: - print("Terminal : SAME PLAYER TRY AGAIN") + logger.info("Terminal : SAME PLAYER TRY AGAIN") send_one_byte_signal(serial, 'EOT') # Wait 1 sec between each attempt time.sleep(1) @@ -39,7 +40,7 @@ def send_one_byte_signal(serial, signal): assert signal in ascii_names, 'Wrong signal' char = ascii_names.index(signal) serial_write(serial, chr(char)) - print('Signal %s sent to terminal' % signal) + logger.info('Signal %s sent to terminal' % signal) def get_one_byte_answer(serial, expected_signal): @@ -47,7 +48,7 @@ def get_one_byte_answer(serial, expected_signal): one_byte_read = serial.read(1).decode('ascii') expected_char = ascii_names.index(expected_signal) if one_byte_read == chr(expected_char): - print("%s received from terminal" % expected_signal) + logger.info("%s received from terminal" % expected_signal) return True else: return False @@ -59,14 +60,14 @@ def prepare_data_to_send(): elif PAYMENT_MODE == 'card': payment_mode = '1' else: - print("The payment mode '%s' is not supported" % PAYMENT_MODE) + logger.info("The payment mode '%s' is not supported" % PAYMENT_MODE) return False cur_iso_letter = CURRENCY_ISO.upper() try: cur = pycountry.currencies.get(alpha_3=cur_iso_letter) cur_numeric = str(cur.numeric) except: - print("Currency %s is not recognized" % cur_iso_letter) + logger.info("Currency %s is not recognized" % cur_iso_letter) return False data = { 'pos_number': str(1).zfill(2), @@ -102,13 +103,13 @@ def send_message(serial, data): data['private'] + data['delay'] + data['auto']) - print('Real message to send = %s' % real_msg) + logger.info('Real message to send = %s' % real_msg) assert len(real_msg) == 34, 'Wrong length for protocol E+' real_msg_with_etx = real_msg + chr(ascii_names.index('ETX')) lrc = generate_lrc(real_msg_with_etx) message = chr(ascii_names.index('STX')) + real_msg_with_etx + chr(lrc) serial_write(serial, message) - print('Message sent to terminal') + logger.info('Message sent to terminal') def compare_data_vs_answer(data, answer_data): @@ -116,7 +117,7 @@ def compare_data_vs_answer(data, answer_data): 'pos_number', 'amount_msg', 'currency_numeric', 'private']: if data[field] != answer_data[field]: - print( + logger.info( "Field %s has value '%s' in data and value '%s' in answer" % (field, data[field], answer_data[field])) @@ -130,7 +131,7 @@ def parse_terminal_answer(real_msg, data): 'currency_numeric': real_msg[12:15], 'private': real_msg[15:26], } - print('answer_data = %s' % answer_data) + logger.info('answer_data = %s' % answer_data) compare_data_vs_answer(data, answer_data) return answer_data @@ -139,19 +140,19 @@ def get_answer_from_terminal(serial, data): ascii_names = curses.ascii.controlnames full_msg_size = 1+2+1+8+1+3+10+1+1 msg = serial.read(size=full_msg_size).decode('ascii') - print('%d bytes read from terminal' % full_msg_size) + logger.info('%d bytes read from terminal' % full_msg_size) assert len(msg) == full_msg_size, 'Answer has a wrong size' if msg[0] != chr(ascii_names.index('STX')): - print('The first byte of the answer from terminal should be STX') + logger.info('The first byte of the answer from terminal should be STX') if msg[-2] != chr(ascii_names.index('ETX')): - print('The byte before final of the answer ' + logger.info('The byte before final of the answer ' 'from terminal should be ETX') lrc = msg[-1] computed_lrc = chr(generate_lrc(msg[1:-1])) if computed_lrc != lrc: - print('The LRC of the answer from terminal is wrong') + logger.info('The LRC of the answer from terminal is wrong') real_msg = msg[1:-2] - print('Real answer received = %s' % real_msg) + logger.info('Real answer received = %s' % real_msg) return parse_terminal_answer(real_msg, data) @@ -160,7 +161,7 @@ def transaction_start(): ''' serial = False try: - print( + logger.info( 'Opening serial port %s for payment terminal with ' 'baudrate %d' % (DEVICE, DEVICE_RATE)) # IMPORTANT : don't modify timeout=3 seconds @@ -168,7 +169,7 @@ def transaction_start(): # that we have to wait to up 3 seconds to get LRC serial = Serial( DEVICE, DEVICE_RATE, timeout=3) - print('serial.is_open = %s' % serial.isOpen()) + logger.info('serial.is_open = %s' % serial.isOpen()) if initialize_msg(serial): data = prepare_data_to_send() if not data: @@ -177,19 +178,19 @@ def transaction_start(): if get_one_byte_answer(serial, 'ACK'): send_one_byte_signal(serial, 'EOT') - print("Now expecting answer from Terminal") + logger.info("Now expecting answer from Terminal") if get_one_byte_answer(serial, 'ENQ'): send_one_byte_signal(serial, 'ACK') get_answer_from_terminal(serial, data) send_one_byte_signal(serial, 'ACK') if get_one_byte_answer(serial, 'EOT'): - print("Answer received from Terminal") + logger.info("Answer received from Terminal") except Exception as e: - print('Exception in serial connection: %s' % str(e)) + logger.info('Exception in serial connection: %s' % str(e)) finally: if serial: - print('Closing serial port for payment terminal') + logger.info('Closing serial port for payment terminal') serial.close()