Skip to content
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

Update prototype stub (flaky test) #3355

Merged
merged 2 commits into from
Feb 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions extension/src/test/suite/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,9 @@ suite('Extension Test Suite', () => {
onDidDelete: () => mockDisposable
})

const mockGetDvcRoots = stub(Setup.prototype, 'getRoots').returns([
dvcDemoPath
])

const mockCanRunCli = stub(DvcReader.prototype, 'version')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[F] I'm thinking that runWithRecheck is using up these calls.

.onFirstCall()
.resolves(MIN_CLI_VERSION)
.onSecondCall()
.rejects('CLI is gone, dispose of everything')

mockCanRunCli.resolves(MIN_CLI_VERSION)

const mockDisposer = stub(Disposer, 'reset')

Expand Down Expand Up @@ -169,7 +163,7 @@ suite('Extension Test Suite', () => {

const mockPath = resolve('path', 'to', 'venv')

void (await setConfigValue(ConfigKey.PYTHON_PATH, mockPath))
await setConfigValue(ConfigKey.PYTHON_PATH, mockPath)

await Promise.all([
firstDisposal,
Expand All @@ -193,7 +187,6 @@ suite('Extension Test Suite', () => {
.been.called
expect(mockPlotsDiff, 'should have updated the plots data').to.have.been
.called
expect(mockGetDvcRoots).to.have.been.called

expect(
mockSendTelemetryEvent,
Expand Down Expand Up @@ -228,10 +221,13 @@ suite('Extension Test Suite', () => {
await workspaceExperimentsAreReady
const secondDisposal = disposalEvent()

void (await setConfigValue(
mockCanRunCli.resetBehavior()
mockCanRunCli.rejects('CLI is gone, dispose of everything')

await setConfigValue(
ConfigKey.PYTHON_PATH,
resolve('path', 'to', 'virtualenv')
))
)

await secondDisposal

Expand Down