Open Hawk777 opened 5 years ago
Indeed, that's a limitation of our backend, we should add this to the documentation.
In addition, we could also register a serializer for a Path
object.
I had assumed that the options were passed textually and reparsed in the child. Obviously that would not have had this limitation, since the CLI parameters were strings to start with before argparse
got its hands on them.
You are right, but to reparse in the worker, you need specialized code for it that knows about pathlib.Path
objects, and currently execnet
does not do it, which is unfortunate. 😕
Oh, no, I meant I assumed that the options weren’t passed as parsed objects at all. I originally assumed that sys.argv
was handed over from parent to child, and of course sys.argv
has nothing but strings in it, so then all the options could just be reparsed in the child. So nobody would need to know about Path
objects, because they’d just be strings during marshalling.
Oh I see what you mean, makes sense. It seems self.channel.send((self.workerinput, args, option_dict))
is trying to send the parsed options directly instead of sys.argv
, which explains the error.
I believe (without looking at the code) that xdist will first parse and handle/filter out some of the arguments, because workers won't know what to do with some options (-n
for example). Not sure how easy is this to fix, it would need more investigation I'm afraid.
Yes, I realize it will need some investigation. I guess there might be cases where, if workers are being run on other machines, then xdist might not be installed on the worker machines so they might not understand -n
. Or even if not that, I suppose the provision of -n
might make the worker try to spawn more workers… Could be complicated, but I think it might be helpful to do sometime.
structurally pytest itself simply does not support required arguments at all we should really warn or error on it instead of failing at "interesting" places
@RonnyPfannschmidt comment on wrong ticket?
@Hawk777 whops, my fault, one shouldn't open all the images right after a oversize dinner
@nicoddemus it looks like this is still happening and options_dict is still being sent
I wanted a command-line option to take a filename as its value. It works fine with vanilla py.test, but not with xdist.