Exemplo n.º 1
0
 static BaseAnalysisTest()
 {
     AnalysisLog.Reset();
     AnalysisLog.ResetTime();
     AssertListener.Initialize();
     PythonTestData.Deploy(includeTestData: false);
 }
Exemplo n.º 2
0
 public void TestInitialize()
 {
     AnalysisLog.Reset();
     AnalysisLog.ResetTime();
     AssertListener.Initialize();
     PythonTestData.Deploy(includeTestData: false);
 }
Exemplo n.º 3
0
        private static int RunPathTests()
        {
            var fg = Console.ForegroundColor;

            foreach (var ver in VERSIONS)
            {
                if (VERBOSE)
                {
                    try {
                        if (File.Exists(string.Format("AnalysisTests.Path.{0}.csv", ver.Version)))
                        {
                            File.Delete(string.Format("AnalysisTests.Path.{0}.csv", ver.Version));
                        }
                    } catch { }
                }
            }

            int failures = 0;

            foreach (var path in OTHER_ARGS)
            {
                if (!Directory.Exists(path))
                {
                    continue;
                }

                foreach (var ver in VERSIONS)
                {
                    if (VERBOSE)
                    {
                        AnalysisLog.ResetTime();
                        AnalysisLog.Output = new StreamWriter(new FileStream(string.Format("AnalysisTests.Path.{0}.csv", ver.Version), FileMode.Append, FileAccess.Write, FileShare.Read), Encoding.UTF8);
                        AnalysisLog.AsCSV  = true;
                        AnalysisLog.Add("Path Start", path, ver.Version, DateTime.Now);
                    }

                    if (!RunOneTest(() => { new AnalysisTest().AnalyzeDir(path, ver.Version); }, string.Format("{0}: {1}", ver.Version, path)))
                    {
                        failures += 1;
                    }
                    Console.ForegroundColor = fg;

                    if (VERBOSE)
                    {
                        AnalysisLog.Flush();
                    }

                    IdDispenser.Clear();
                }
            }
            return(failures);
        }
Exemplo n.º 4
0
        private static int RunDjangoTests()
        {
            var fg = Console.ForegroundColor;

            foreach (var ver in VERSIONS)
            {
                if (VERBOSE)
                {
                    try {
                        if (File.Exists(string.Format("AnalysisTests.Django.{0}.csv", ver.Version)))
                        {
                            File.Delete(string.Format("AnalysisTests.Django.{0}.csv", ver.Version));
                        }
                    } catch { }
                }
            }

            int failures = 0;

            foreach (var ver in VERSIONS)
            {
                var djangoPath = Path.Combine(ver.PrefixPath, "Lib", "site-packages", "django");
                if (!Directory.Exists(djangoPath))
                {
                    Trace.TraceInformation("Path {0} not found; skipping {1}", djangoPath, ver.Version);
                    continue;
                }

                if (VERBOSE)
                {
                    AnalysisLog.ResetTime();
                    AnalysisLog.Output = new StreamWriter(new FileStream(string.Format("AnalysisTests.Django.{0}.csv", ver.Version), FileMode.Append, FileAccess.Write, FileShare.Read), Encoding.UTF8);
                    AnalysisLog.AsCSV  = true;
                    AnalysisLog.Add("Django Start", ver.InterpreterPath, ver.Version, DateTime.Now);
                }

                if (!RunOneTest(() => { new AnalysisTest().AnalyzeDir(djangoPath, ver.Version); }, ver.InterpreterPath))
                {
                    failures += 1;
                }
                Console.ForegroundColor = fg;

                if (VERBOSE)
                {
                    AnalysisLog.Flush();
                }

                IdDispenser.Clear();
            }
            return(failures);
        }
Exemplo n.º 5
0
        private static int RunStdLibTests()
        {
            var fg = Console.ForegroundColor;

            foreach (var ver in VERSIONS)
            {
                if (VERBOSE)
                {
                    try {
                        if (File.Exists(string.Format("AnalysisTests.StdLib.{0}.csv", ver.Version)))
                        {
                            File.Delete(string.Format("AnalysisTests.StdLib.{0}.csv", ver.Version));
                        }
                    } catch { }
                }
            }

            int failures = 0;

            foreach (var ver in VERSIONS)
            {
                if (VERBOSE)
                {
                    AnalysisLog.ResetTime();
                    AnalysisLog.Output = new StreamWriter(new FileStream(string.Format("AnalysisTests.StdLib.{0}.csv", ver.Version), FileMode.Append, FileAccess.Write, FileShare.Read), Encoding.UTF8);
                    AnalysisLog.AsCSV  = true;
                    AnalysisLog.Add("StdLib Start", ver.InterpreterPath, ver.Version, DateTime.Now);
                }

                if (!RunOneTest(() => {
                    new AnalysisTest().AnalyzeDir(Path.Combine(ver.PrefixPath, "Lib"), ver.Version, new[] { "site-packages" });
                }, ver.InterpreterPath))
                {
                    failures += 1;
                }
                Console.ForegroundColor = fg;

                if (VERBOSE)
                {
                    AnalysisLog.Flush();
                }

                IdDispenser.Clear();
            }
            return(failures);
        }