Skip to content

Commit

Permalink
Add pytest-xdist's -n to the list of supported options for pytest (#6565
Browse files Browse the repository at this point in the history
)

* Add pytest-xdist's n to the supported options list
* Better comment
* Add some tests
* Add some more tests
  • Loading branch information
kimadeline committed Jul 15, 2019
1 parent 4738d9d commit 8baea3f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions news/2 Fixes/6293.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add pytest-xdist's -n option to the list of supported pytest options.
1 change: 1 addition & 0 deletions src/client/testing/pytest/services/argsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { IServiceContainer } from '../../../ioc/types';
import { IArgumentsHelper, IArgumentsService, TestFilter } from '../../types';

const OptionsWithArguments = ['-c', '-k', '-m', '-o', '-p', '-r', '-W',
'-n', // -n is a pytest-xdist option
'--assert', '--basetemp', '--capture', '--color', '--confcutdir',
'--cov', '--cov-config', '--cov-fail-under', '--cov-report',
'--deselect', '--dist', '--doctest-glob',
Expand Down
19 changes: 19 additions & 0 deletions src/test/testing/pytest/pytest.argsService.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,23 @@ suite('ArgsService: pytest', () => {
expect(testDirs[1]).to.equal(dir);
expect(testDirs[2]).to.equal(dir2);
});
test('Test getting the list of known options for pytest', () => {
const knownOptions = argumentsService.getKnownOptions();
expect(knownOptions.withArgs.length).to.not.equal(0);
expect(knownOptions.withoutArgs.length).to.not.equal(0);
});
test('Test calling ArgumentsService.getOptionValue with the option followed by the value', () => {
const knownOptionsWithValues = argumentsService.getKnownOptions().withArgs;
knownOptionsWithValues.forEach(option => {
const args = ['--foo', '--bar', 'arg1', option, 'value1'];
expect(argumentsService.getOptionValue(args, option)).to.deep.equal('value1');
});
});
test('Test calling ArgumentsService.getOptionValue with the inline option syntax', () => {
const knownOptionsWithValues = argumentsService.getKnownOptions().withArgs;
knownOptionsWithValues.forEach(option => {
const args = ['--foo', '--bar', 'arg1', `${option}=value1`];
expect(argumentsService.getOptionValue(args, option)).to.deep.equal('value1');
});
});
});

0 comments on commit 8baea3f

Please sign in to comment.