Skip to content

Commit

Permalink
Merge branch 'main' into show-experiment-name-in-table-header
Browse files Browse the repository at this point in the history
  • Loading branch information
wolmir authored May 20, 2022
2 parents 0ace9a8 + 38fb548 commit e5a05e5
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 31 deletions.
30 changes: 1 addition & 29 deletions extension/src/test/cli/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { mkdirp } from 'fs-extra'
import { URI } from 'vscode-uri'
import { stub } from 'sinon'
import mock from 'mock-require'
import { TEMP_DIR, ENV_DIR } from './constants'
require('../../vscode/mockModule')

const importModulesAfterMockingVsCode = () => {
const { removeDir } = require('../../fileSystem')
Expand All @@ -12,32 +10,6 @@ const importModulesAfterMockingVsCode = () => {
return { removeDir, runMocha, setupVenv }
}

class MockEventEmitter {
public fire() {
return stub()
}

public event() {
return stub()
}
}

mock('vscode', {
EventEmitter: MockEventEmitter,
Uri: {
file: URI.file
}
})

mock('@hediet/std/disposable', {
Disposable: {
fn: () => ({
track: <T>(disposable: T): T => disposable,
untrack: () => undefined
})
}
})

const { setupVenv, removeDir, runMocha } = importModulesAfterMockingVsCode()

async function main() {
Expand Down
29 changes: 29 additions & 0 deletions extension/src/vscode/mockModule.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { URI } from 'vscode-uri'
import { stub } from 'sinon'
import mock from 'mock-require'

class MockEventEmitter {
public fire() {
return stub()
}

public event() {
return stub()
}
}

mock('vscode', {
EventEmitter: MockEventEmitter,
Uri: {
file: URI.file
}
})

mock('@hediet/std/disposable', {
Disposable: {
fn: () => ({
track: <T>(disposable: T): T => disposable,
untrack: () => undefined
})
}
})
2 changes: 1 addition & 1 deletion extension/src/vscode/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const createTreeView = <T>(
treeDataProvider: TreeDataProvider<string | T>
): TreeView<string | T> =>
window.createTreeView<string | T>(name, {
canSelectMany: true,
canSelectMany: false,
showCollapseAll: true,
treeDataProvider
})
Expand Down
10 changes: 9 additions & 1 deletion scripts/virtualenv-install.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { join, resolve } from 'path'
import { setupVenv } from 'dvc/src/python'
require('dvc/src/vscode/mockModule')

const importModuleAfterMockingVsCode = () => {
const { setupVenv } = require('dvc/src/python')

return setupVenv
}

const setupVenv = importModuleAfterMockingVsCode()

const cwd = resolve(__dirname, '..', 'demo')

Expand Down

0 comments on commit e5a05e5

Please sign in to comment.