Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 4/5] support/testing: add python-incremental tests
Date: Thu, 11 Oct 2018 20:46:41 +0200	[thread overview]
Message-ID: <20181011204641.6ded469a@windsurf> (raw)
In-Reply-To: <20180926025514.2092-5-ricardo.martincoski@gmail.com>

Hello,

On Tue, 25 Sep 2018 23:55:13 -0300, Ricardo Martincoski wrote:

> +class TestPythonIncremental(TestPythonBase):
> +    def str_test(self):
> +        cmd = self.interpreter + " -c 'import incremental;"
> +        cmd += "v = incremental.Version(\"package\", 1, 2, 3, release_candidate=4);"
> +        cmd += "assert(str(v) == \"[package, version 1.2.3rc4]\")'"

When I see this, I wonder if it wouldn't be nicer to do something like
this:

class PythonIncremental(TestPythonBase):
	python_prog = """
import incremental
incremental.Version("package", 1, 2, 3, release_candidate=4)
assert(str(v) == "[package, version 1.2.3rc4]")
"""

and have the base TestPythonBase class have some logic that executes
this as a Python script with the Python interpreter.

It would make the thing a bit more readable. Also, the TestPythonBase
class could push things a bit further, and have a default
implementation of test_run() that does self.login() + execute the
Python program in python_prog.

This way, those simple Python tests only need to provide the Buildroot
configuration and the small Python program to run.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  parent reply	other threads:[~2018-10-11 18:46 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-26  2:55 [Buildroot] [PATCH 0/5] a few more runtime test cases for python packages - series 1/n Ricardo Martincoski
2018-09-26  2:55 ` [Buildroot] [PATCH 1/5] support/testing: add python-autobahn tests Ricardo Martincoski
2018-09-26  7:07   ` Yegor Yefremov
2018-09-26  2:55 ` [Buildroot] [PATCH 2/5] support/testing: add python-txaio tests Ricardo Martincoski
2018-09-26  7:08   ` Yegor Yefremov
2018-09-26  2:55 ` [Buildroot] [PATCH 3/5] support/testing: add python-txtorcon tests Ricardo Martincoski
2018-09-26  7:21   ` Yegor Yefremov
2018-09-26  2:55 ` [Buildroot] [PATCH 4/5] support/testing: add python-incremental tests Ricardo Martincoski
2018-09-26  7:09   ` Yegor Yefremov
2018-10-11 18:46   ` Thomas Petazzoni [this message]
2018-10-14 22:07     ` Ricardo Martincoski
2018-09-26  2:55 ` [Buildroot] [PATCH 5/5] support/testing: add python-twisted tests Ricardo Martincoski
2018-09-26  7:20   ` Yegor Yefremov
2018-09-29  5:35   ` Ricardo Martincoski
2018-10-11 18:48   ` Thomas Petazzoni
2018-10-11 21:27     ` Arnout Vandecappelle
2018-10-13 12:48       ` Thomas Petazzoni
2018-10-13 14:43       ` Yann E. MORIN
2018-10-14 22:11         ` Ricardo Martincoski
2018-10-14 22:08       ` Ricardo Martincoski
2018-10-11 18:42 ` [Buildroot] [PATCH 0/5] a few more runtime test cases for python packages - series 1/n Thomas Petazzoni
2018-10-11 18:53   ` Thomas Petazzoni
2018-11-16  3:57 ` [Buildroot] [next 00/15] a few more runtime test cases for python packages - series 2/n Ricardo Martincoski
2018-11-16  3:57   ` [Buildroot] [next 01/15] support/testing: add python-argh tests Ricardo Martincoski
2018-11-16  3:57   ` [Buildroot] [next 02/15] support/testing: add python-attrs tests Ricardo Martincoski
2018-11-16  3:57   ` [Buildroot] [next 03/15] support/testing: add python-automat tests Ricardo Martincoski
2018-11-16  3:57   ` [Buildroot] [next 04/15] support/testing: add python-bitstring tests Ricardo Martincoski
2018-11-16  3:57   ` [Buildroot] [next 05/15] support/testing: add python-cbor tests Ricardo Martincoski
2018-11-16  3:57   ` [Buildroot] [next 06/15] support/testing: add python-click tests Ricardo Martincoski
2018-11-16  3:57   ` [Buildroot] [next 07/15] support/testing: add python-constantly tests Ricardo Martincoski
2018-11-16  3:57   ` [Buildroot] [next 08/15] support/testing: add python-passlib tests Ricardo Martincoski
2018-11-16  3:57   ` [Buildroot] [next 09/15] support/testing: add python-pexpect tests Ricardo Martincoski
2018-11-16  3:57   ` [Buildroot] [next 10/15] support/testing: add python-pynacl tests Ricardo Martincoski
2018-11-16  3:57   ` [Buildroot] [next 11/15] support/testing: add python-pyyaml tests Ricardo Martincoski
2018-11-16  3:57   ` [Buildroot] [next 12/15] support/testing: add python-service-identity tests Ricardo Martincoski
2018-11-16  3:57   ` [Buildroot] [next 13/15] support/testing: add python-subprocess32 test Ricardo Martincoski
2018-11-16  3:57   ` [Buildroot] [next 14/15] support/testing: add python-treq tests Ricardo Martincoski
2018-11-16  3:57   ` [Buildroot] [next 15/15] support/testing: add python-ubjson tests Ricardo Martincoski
2018-11-23 21:09   ` [Buildroot] [next 00/15] a few more runtime test cases for python packages - series 2/n Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181011204641.6ded469a@windsurf \
    --to=thomas.petazzoni@bootlin.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox