Re: [pytest-dev] How to duplicate pytest.Item inside function 'pytest_collection_modifyitems'?

2020-04-15 Thread Anton Shiban
Hi Ronny, Thanks a lot for your reply, I got your points that pytest does have such support. And also I got your points that I can create new Item which is reasonably equivalent, but I dont know whether the same code may continuously work for all future release of PYTEST and it may

Re: [pytest-dev] How to duplicate pytest.Item inside function 'pytest_collection_modifyitems'?

2020-04-15 Thread Ronny Pfannschmidt
*copey with the correct mail* Hi Shiban, its not safely possible to clone a item in general. A) you need to make a new nodeid to prevent some issues B) there is no safe cloning mechanism declared, different subtypes of items have different mutable state you dont want to mix I believe the

Re: [pytest-dev] How to duplicate pytest.Item inside function 'pytest_collection_modifyitems'?

2020-04-15 Thread Florian Bruhin
Hey, On Wed, Apr 15, 2020 at 03:16:45AM +0530, Anton Shiban wrote: > Can you please guide me *how to* *clone pytest.Item?* > > I want to take one *item* from *items* array (inside function > ‘pytest_collection_modifyitems’) and clone that *item* and add it to *items* > array back. > > Can

Re: [pytest-dev] How to duplicate pytest.Item inside function 'pytest_collection_modifyitems'?

2020-04-14 Thread Anton Shiban
Thanks Imran. I tried this copy.deepcopy() already and it fails with below error. "TypeError: cannot deepcopy this pattern object" Is there any other way to do this? Thanks, Shiban. On Wed, Apr 15, 2020 at 3:26 AM Imran M wrote: > Sounds like you want a deep copy? > >

Re: [pytest-dev] How to duplicate pytest.Item inside function 'pytest_collection_modifyitems'?

2020-04-14 Thread Imran M
Sounds like you want a deep copy? https://docs.python.org/3.8/library/copy.html Not sure if there's a Pytest way of doing this. On Tue, Apr 14, 2020, 2:46 PM Anton Shiban wrote: > Hi, > > > Can you please guide me *how to* *clone pytest.Item?* > > I want to take one *item* from *items* array

[pytest-dev] How to duplicate pytest.Item inside function 'pytest_collection_modifyitems'?

2020-04-14 Thread Anton Shiban
Hi, Can you please guide me *how to* *clone pytest.Item?* I want to take one *item* from *items* array (inside function ‘pytest_collection_modifyitems’) and clone that *item* and add it to *items* array back. Can someone please guide to do this? Thanks, Shiban.