public async Task UseAfterDispose(bool is3x) { using (var s = await CreateServicesAsync(null, is3x ? PythonVersions.LatestAvailable3X : PythonVersions.LatestAvailable2X, null)) using (var inspector = new PythonInspectorService(s)) { var version = await inspector.GetModuleVersionAsync("setuptools"); version.Should().NotBeNullOrEmpty(); inspector.Dispose(); version = await inspector.GetModuleVersionAsync("setuptools"); version.Should().NotBeNullOrEmpty(); } }
public async Task ModuleVersionNotFound(bool is3x) { using (var s = await CreateServicesAsync(null, is3x ? PythonVersions.LatestAvailable3X : PythonVersions.LatestAvailable2X, null)) using (var inspector = new PythonInspectorService(s)) { var version = await inspector.GetModuleVersionAsync("thismoduledoesnotexist"); version.Should().BeNull(); } }
public async Task Cancel(bool is3x) { var token = new CancellationToken(true); using (var s = await CreateServicesAsync(null, is3x ? PythonVersions.LatestAvailable3X : PythonVersions.LatestAvailable2X, null)) using (var inspector = new PythonInspectorService(s)) { Func <Task> action = async() => { await inspector.GetModuleVersionAsync("setuptools", token); }; action.Should().Throw <OperationCanceledException>(); } }