public static SetLocalLibsAsync ( IRExpressionEvaluator eval ) : System.Threading.Tasks.Task | ||
eval | IRExpressionEvaluator | |
Результат | System.Threading.Tasks.Task |
public async Task LoadAndUnloadPackage() { using (var eval = await _workflow.RSession.BeginEvaluationAsync()) { await TestRepositories.SetLocalRepoAsync(eval, _repoPath); await TestLibraries.SetLocalLibsAsync(eval, _libPath); await InstallPackageAsync(eval, TestPackages.RtvsLib1Description.Package, _libPath); } await EvaluateCode("func1();", expectedError : "Error: could not find function \"func1\""); await _workflow.Packages.LoadPackageAsync(TestPackages.RtvsLib1Description.Package, null); await EvaluateCode("func1();", expectedResult : "func1"); var loaded = await _workflow.Packages.GetLoadedPackagesAsync(); loaded.Should().Contain("rtvslib1"); await _workflow.Packages.UnloadPackageAsync(TestPackages.RtvsLib1Description.Package); await EvaluateCode("func1();", expectedError : "Error: could not find function \"func1\""); loaded = await _workflow.Packages.GetLoadedPackagesAsync(); loaded.Should().NotContain("rtvslib1"); }
public async Task InstalledPackagesMultiLibsSamePackage() { // Install the same package in 2 different libraries using (var eval = await _workflow.RSession.BeginEvaluationAsync()) { await TestRepositories.SetLocalRepoAsync(eval, _repoPath); await TestLibraries.SetLocalLibsAsync(eval, _libPath); await InstallPackageAsync(eval, TestPackages.RtvsLib1Description.Package, _libPath); await TestLibraries.SetLocalLibsAsync(eval, _lib2Path); await InstallPackageAsync(eval, TestPackages.RtvsLib1Description.Package, _lib2Path); await TestLibraries.SetLocalLibsAsync(eval, _libPath, _lib2Path); } var result = await _workflow.Packages.GetInstalledPackagesAsync(); ValidateRtvslib1Installed(result, _libPath); using (var eval = await _workflow.RSession.BeginEvaluationAsync()) { await TestLibraries.SetLocalLibsAsync(eval, _lib2Path, _libPath); } result = await _workflow.Packages.GetInstalledPackagesAsync(); ValidateRtvslib1Installed(result, _lib2Path); }
public async Task LibraryPaths() { await TestRepositories.SetLocalRepoAsync(_workflow.RSession, _repoPath); await TestLibraries.SetLocalLibsAsync(_workflow.RSession, _libPath); var result = await _workflow.Packages.GetLibraryPathAsync(); result.Should().Be(_libPath.ToRPath()); }
public async Task InstalledPackagesCustomLibPathNoPackages() { // Setup library path to point to the test folder, don't install anything in it await TestLibraries.SetLocalLibsAsync(_workflow.RSession, _libPath); var result = await _workflow.Packages.GetInstalledPackagesAsync(); // Since we can't remove Program Files folder from library paths, // we'll get some results, but nothing from the test folder. result.Should().NotBeEmpty().And.NotContain(pkg => pkg.LibPath == _libPath.ToRPath()); }
public async Task LibraryPaths() { using (var eval = await _workflow.RSession.BeginEvaluationAsync()) { await TestRepositories.SetLocalRepoAsync(eval, _repoPath); await TestLibraries.SetLocalLibsAsync(eval, _libPath); } var result = await _workflow.Packages.GetLibraryPathsAsync(); result[0].Should().Be(_libPath.ToRPath()); }
public async Task InstallPackageDefaultLib() { await TestRepositories.SetLocalRepoAsync(_workflow.RSession, _repoPath); await TestLibraries.SetLocalLibsAsync(_workflow.RSession, _libPath); await _workflow.Packages.InstallPackageAsync(TestPackages.RtvsLib1Description.Package, null); var installed = await _workflow.Packages.GetInstalledPackagesAsync(); ValidateRtvslib1Installed(installed, _libPath); }
public async Task GetPackageLockStateUnlocked() { using (var eval = await _workflow.RSession.BeginEvaluationAsync()) { await TestLibraries.SetLocalLibsAsync(eval, _libPath); await InstallPackageAsync(eval, "abn", _libPath); } var pkgs = await _workflow.Packages.GetInstalledPackagesAsync(); var abn = pkgs.Should().ContainSingle(pkg => pkg.Package == "abn").Which; _workflow.Packages.GetPackageLockState(abn.Package, abn.LibPath).Should().Be(PackageLockState.Unlocked); }
public async Task InstalledPackagesCustomLibPathOnePackage() { // Setup library path to point to the test folder, install a package into it await TestRepositories.SetLocalRepoAsync(_workflow.RSession, _repoPath); await TestLibraries.SetLocalLibsAsync(_workflow.RSession, _libPath); await InstallPackageAsync(_workflow.RSession, TestPackages.RtvsLib1Description.Package, _libPath); var result = await _workflow.Packages.GetInstalledPackagesAsync(); ValidateRtvslib1Installed(result, _libPath); }
public async Task GetPackageLockStateUnlocked() { await TestLibraries.SetLocalLibsAsync(_workflow.RSession, _libPath); await InstallPackageAsync(_workflow.RSession, "abn", _libPath); var pkgs = await _workflow.Packages.GetInstalledPackagesAsync(); var abn = pkgs.Should().ContainSingle(pkg => pkg.Package == "abn").Which; var abnState = await _workflow.Packages.GetPackageLockStateAsync(abn.Package, abn.LibPath); abnState.Should().Be(PackageLockState.Unlocked); }
public async Task GetLoadedPackages() { await TestRepositories.SetLocalRepoAsync(_workflow.RSession, _repoPath); await TestLibraries.SetLocalLibsAsync(_workflow.RSession, _libPath); await InstallPackageAsync(_workflow.RSession, TestPackages.RtvsLib1Description.Package, _libPath); var results = await _workflow.Packages.GetLoadedPackagesAsync(); results.Should().NotContain(new[] { "rtvslib1", ".GlobalEnv", "Autoloads", }); results.Should().Contain(new[] { "stats", "graphics", "grDevices", "grDevices", "utils", "datasets", "methods", "base", }); }
public async Task InstallAndUninstallPackageSpecifiedLib() { await TestRepositories.SetLocalRepoAsync(_workflow.RSession, _repoPath); await _workflow.Packages.InstallPackageAsync(TestPackages.RtvsLib1Description.Package, _libPath); await TestLibraries.SetLocalLibsAsync(_workflow.RSession, _libPath); var installed = await _workflow.Packages.GetInstalledPackagesAsync(); ValidateRtvslib1Installed(installed, _libPath); await _workflow.Packages.UninstallPackageAsync(TestPackages.RtvsLib1Description.Package, _libPath); installed = await _workflow.Packages.GetInstalledPackagesAsync(); installed.Should().NotContain(pkg => pkg.Package == TestPackages.RtvsLib1Description.Package && pkg.LibPath == _libPath.ToRPath()); }
public async Task GetPackageLockStateLockByRSession() { await TestLibraries.SetLocalLibsAsync(_workflow.RSession, _libPath); await InstallPackageAsync(_workflow.RSession, "abn", _libPath); await _workflow.Packages.LoadPackageAsync("abn", null); var pkgs = await _workflow.Packages.GetInstalledPackagesAsync(); var abn = pkgs.Should().ContainSingle(pkg => pkg.Package == "abn").Which; var cairo = pkgs.Should().ContainSingle(pkg => pkg.Package == "Cairo").Which; var abnState = await _workflow.Packages.GetPackageLockStateAsync(abn.Package, abn.LibPath); abnState.Should().Be(PackageLockState.LockedByRSession); var cairoState = await _workflow.Packages.GetPackageLockStateAsync(cairo.Package, cairo.LibPath); cairoState.Should().Be(PackageLockState.LockedByRSession); }