-
Notifications
You must be signed in to change notification settings - Fork 4.2k
feat(codegen): pytest support in codegen #13746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This is a proposal to add support for pytest in the code generator
I'm supportive for adding this kind of the codegen. I would not copy and paste though - take a look at a sibling |
@pavelfeldman I updated in 56ebcaf based on your recommendation. Should I also add tests? The Javascript test does not have this either. |
Take a look at this file - it is testing the javascript implementation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! If you would make device emulation configurable, that would be just wonderful! If you don't have cycles for that, just let us know and we'll follow up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR!
constructor(isAsync: boolean) { | ||
this.id = isAsync ? 'python-async' : 'python'; | ||
this.fileName = isAsync ? 'Python Async' : 'Python'; | ||
constructor(isAsync: boolean, isTest: boolean) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constructor(isAsync: boolean, isTest: boolean) { | |
constructor(isAsync: boolean, isPyTest: boolean) { |
this._isAsync = isAsync; | ||
this._isTest = isTest; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this._isTest = isTest; | |
this._isPyTest = isPyTest; |
if (this._isTest) { | ||
return ''; | ||
} else if (this._isAsync) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (this._isTest) { | |
return ''; | |
} else if (this._isAsync) { | |
if (this._isTest) | |
return ''; | |
if (this._isAsync) { |
}); | ||
|
||
test('should save the codegen output to a file if specified', async ({ runCLI }, testInfo) => { | ||
const tmpFile = testInfo.outputPath('script.js'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const tmpFile = testInfo.outputPath('script.js'); | |
const tmpFile = testInfo.outputPath('test_foo.py'); |
nit
This is a proposal to add support for
pytest
in the code generatorNOTE:
Everything here are roughly a copy-pasted from thePythonLanguageGenerator
. Hope it gains approval from community.so this can be removed/turned off([FEATURE] Expose Playwright async/await flavor playwright-pytest#74)