Skip to content

Commit

Permalink
Checks
Browse files Browse the repository at this point in the history
Still check custom exe file is a Python interpreter of the right major version
  • Loading branch information
jas88 committed Nov 13, 2023
1 parent 2e142c3 commit e980012
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void PythonScript_Timeout()
[Test]
public void PythonScript_OverrideExecutablePath_DodgyFileType()
{
var MyPythonScript = @"s = raw_input ('==>')";
const string MyPythonScript = "s = raw_input ('==>')";

var py = Path.Combine(TestContext.CurrentContext.WorkDirectory, "Myscript.py");

Expand All @@ -105,7 +105,7 @@ public void PythonScript_OverrideExecutablePath_DodgyFileType()
//call with accept all
var ex = Assert.Throws<Exception>(()=>provider.Check(new AcceptAllCheckNotifier()));

StringAssert.Contains(@"Myscript.py file is not called python.exe... what is going on here?",ex.Message);
StringAssert.Contains(@"Myscript.py file is not called python.exe... what is going on here?",ex?.Message);
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using Rdmp.Core.DataLoad;
using Rdmp.Core.DataLoad.Engine.DataProvider;
using Rdmp.Core.DataLoad.Engine.Job;
using Rdmp.Core.ReusableLibraryCode.Annotations;
using Rdmp.Core.ReusableLibraryCode.Checks;
using Rdmp.Core.ReusableLibraryCode.Progress;

Expand Down Expand Up @@ -73,9 +72,6 @@ public void Check(ICheckNotifier notifier)
//make sure Python is installed
try
{
// If the override exe exists, trust it.
if (OverridePythonExecutablePath?.Exists == true) return;

var version = GetPythonVersion();

if (version?.StartsWith(GetExpectedPythonVersion(), StringComparison.Ordinal)==true)
Expand Down Expand Up @@ -149,6 +145,14 @@ public void Initialize(ILoadDirectory hicProjectDirectory, DiscoveredDatabase db

public ExitCodeType Fetch(IDataLoadJob job, GracefulCancellationToken cancellationToken)
{
if (string.IsNullOrWhiteSpace(FullPathToPythonScriptToRun))
{
job.OnNotify(this,
new NotifyEventArgs(ProgressEventType.Error,
"No Python script provided"));
return ExitCodeType.Error;
}

int exitCode;
try
{
Expand Down

0 comments on commit e980012

Please sign in to comment.