Exemplo n.º 1
0
        public void TestCanInstallPythonCheck()
        {
            // In order to have this function return true, python would need to not be installed
            // or loaded. However, this would require restarting Unity which is out of scope for this test.
            // Instead test all the cases where the function should return false.

            // With 0 versionStatus correct package is already installed, nothing to do
            Assert.That(PythonRunner.CanInstallPythonCheck(versionStatus: 0, localPackage: false), Is.False);
            Assert.That(PythonRunner.CanInstallPythonCheck(versionStatus: 0, localPackage: true), Is.False);

            // With versionStatus < 0, needsDowngrade, but don't do so immediately
            Assert.That(PythonRunner.CanInstallPythonCheck(versionStatus: -1, localPackage: false), Is.False);
            Assert.That(PythonRunner.CanInstallPythonCheck(versionStatus: -1, localPackage: true), Is.False);

            // With versionStatus > 0, needs upgrade but don't do so immediately
            Assert.That(PythonRunner.CanInstallPythonCheck(versionStatus: 1, localPackage: false), Is.False);
            Assert.That(PythonRunner.CanInstallPythonCheck(versionStatus: 1, localPackage: true), Is.False);
        }