Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
Context "Registry Keys Don't Exist" { BeforeAll { New-Item -Path "TestRegistry:\Software\Python" -Force Mock -CommandName Test-Path -MockWith { return $false } } It "Passes Adds Entries To Registry" { Set-PyPyLauncherEntry -PythonVersion "3.10.12" -PyPyVersion "7.3.12" -InstallPath "C:\PyPy" -RegistryDrive "TestRegistry" $CoreInfo = Get-ItemProperty "TestRegistry:\Software\Python\PyPyInstaller\3.10" $CoreInfo.DisplayName | Should -Be "PyPy 3.10.12" $CoreInfo.SupportUrl | Should -Be "https://github.com/cwgem/pypy-powershell-install" $CoreInfo.Version | Should -Be "7.3.12" $CoreInfo.SysVersion | Should -Be "3.10.12" $CoreInfo.SysArchitecture | Should -Be "64bit" $InstallPathInfo = Get-ItemProperty "TestRegistry:\Software\Python\PyPyInstaller\3.10\InstallPath" $InstallPathInfo.'(default)' | Should -Be "C:\PyPy" $InstallPathInfo.ExecutablePath | Should -Be "C:\PyPy\pypy.exe" $InstallPathInfo.WindowedExecutablePath | Should -Be "C:\PyPy\pypyw.exe" } }
Pester is what's used for most Powershell testing. While it has some pretty amazing features, it does have issues with .NET class method mocking and sometimes scope can be weird. Here's a simple example: