public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Mikko Rapeli <mikko.rapeli@linaro.org>
To: Ross Burton <Ross.Burton@arm.com>,
	"openembedded-core@lists.openembedded.org"
	<openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] [PATCH] oeqa parselogs.py: load ignore files from sys.path
Date: Fri, 19 Jan 2024 09:27:03 +0200	[thread overview]
Message-ID: <ZaokR9vovtUH-0cO@nuoska> (raw)
In-Reply-To: <17A9026E670466F3.1780@lists.openembedded.org>

Hi,

I think this patch should be applied as it aligns oeqa .py and .text file searches
across layers. Without this layers need to add "addpylib ${LAYERDIR}/lib oeqa"
in layer.conf which doesn't have any other uses and debugging this is really hard.

There may be addition things wrong in bitbake python environment when oeqa tests run
but this is already an improvement.

Ross, do you agree?

Cheers,

-Mikko

On Wed, Jan 10, 2024 at 04:23:22PM +0200, Mikko Rapeli via lists.openembedded.org wrote:
> Hi,
> 
> On Wed, Jan 10, 2024 at 02:01:36PM +0000, Ross Burton wrote:
> > On 10 Jan 2024, at 13:03, Mikko Rapeli via lists.openembedded.org <mikko.rapeli=linaro.org@lists.openembedded.org> wrote:
> > > python import.resources open_text() loads files from the module paths
> > > but this requires layers to set "addpylib ${LAYERDIR}/lib oeqa"
> > > which is not needed to find the plain .py test files to run the tests.
> > > Also an empty __init__.py file in a layer will break the resource file
> > > loading completely as only that path with __init__.py file will
> > > be used to search the resource files. Then open_text() is marked
> > > as deprecated from python 3.11 onwards
> > > https://docs.python.org/3/library/importlib.resources.html
> > 
> > Deprecated but replaceable with files(package).joinpath(resource).open() (which is all open_text does internally).
> 
> Yes, but that seems to break if __init__.py file is found from
> ${LAYERDIR}/lib/oeqa/runtime/cases.
> 
> > > So replace open_text() by iterating over sys.path to find the ignore
> > > files. This works since paths like ${LAYERDIR}/lib/oeqa/runtime/cases are
> > > already in sys.path. Add debug prints for found and not found files
> > > while at it.
> > 
> > I’m confused why lib/oeqa/runtime/cases is on sys.path directly, that sounds… unusual.  Do you have any idea where that comes from?  I’m guessing oeqa is throwing it on the path whilst searching for test cases, but that sounds like bad behaviour that should be removed to me.
> 
> No idea where this comes from, but it's there. addpylib is doing similar things,
> adding paths to sys.path and for this use case this not really necessary as
> ${LAYERDIR}/lib should not need to be, it only has oeqa directory. I presume
> test case loading via testimage.bbclass or OERuntim are adding it. These are kind
> of hard to debug since "bitbake -e" show any of this.
> 
> It's a bit odd that layer.conf would need "addpylib ${LAYERDIR}/lib oeqa" for loading
> .txt files but that's not needed for finding and using the oeqa .py test files.
> With this change addpylib magic is not needed, at least for finding these
> .txt files.
> 
> Cheers,
> 
> -Mikko

> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#193513): https://lists.openembedded.org/g/openembedded-core/message/193513
> Mute This Topic: https://lists.openembedded.org/mt/103639917/7159507
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [mikko.rapeli@linaro.org]
> -=-=-=-=-=-=-=-=-=-=-=-
> 



  parent reply	other threads:[~2024-01-19  7:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-10 13:03 [PATCH] oeqa parselogs.py: load ignore files from sys.path Mikko Rapeli
2024-01-10 14:01 ` [OE-core] " Ross Burton
2024-01-10 14:23   ` Mikko Rapeli
     [not found]   ` <17A9026E670466F3.1780@lists.openembedded.org>
2024-01-19  7:27     ` Mikko Rapeli [this message]
2024-02-27 14:34 ` Richard Purdie

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=ZaokR9vovtUH-0cO@nuoska \
    --to=mikko.rapeli@linaro.org \
    --cc=Ross.Burton@arm.com \
    --cc=openembedded-core@lists.openembedded.org \
    /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