Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sDNA commands in the batch file tests specifying %sdnadll% unquoted cannot be run in the same session as benchmark_dll.py #15

Open
JamesParrott opened this issue Feb 8, 2024 · 0 comments

Comments

@JamesParrott
Copy link
Collaborator

JamesParrott commented Feb 8, 2024

This python code (taken from sDNA\sdna_vs2008\tests\benchmark_dll.py) requires the env var of the dll path not to include surrounding quotes (otherwise it errors when loading the dll):

import ctypes
import os

sdnadll = os.environ["sdnadll"]
print("dll name",sdnadll)

dll = ctypes.windll.LoadLibrary(sdnadll)

If sDNA is installed to the default location on Windows (c:\Program Files (x86)\sDNA), the path to its dll contains a space. In this case, these commands that launch sDNA (taken from sDNA\sdna_vs2008\tests\run_debug_test.bat ) must have the %sdnadll% quoted in --dll %sdnadll%. Otherwise cmd.exe splits the path at the space, and sDNA treats the portion after the space as the config string, then complains about extra args. I assume producing such an error was not the intention behind all 7 command strings:

%pythonexe% -u ..\..\..\arcscripts\bin\sdnaintegral.py --dll %sdnadll% --im "net=zonetest;tables=zonetesttable.csv,zonetesttable2.csv" --om "net=tabletestout_%outputsuffix%.shp" "linkonly;zonesums=lulinks=landuse*FULLlf@origzone,eucsum=euc@destzone;origweightformula=zoneweight*one*dztest*landuse*FULLlf/lulinks;destweightformula=eucsum;metric=HYBRID;lineformula=fwd?lulinks:eucsum*landuse;ignorenonlinear" >testout_table_%outputsuffix%.txt 
%pythonexe% -u ..\..\..\arcscripts\bin\sdnaintegral.py --dll %sdnadll% --im "net=zonetest;tables=zonetesttable.csv" --om "net=tabletestout1_%outputsuffix%.shp" "linkonly;zonesums=one=1@destzone" >>testout_table_%outputsuffix%.txt 
echo "duplicate zone and net data test" >>testout_table_%outputsuffix%.txt
%pythonexe% -u ..\..\..\arcscripts\bin\sdnaintegral.py --dll %sdnadll% --im "net=zonetest;tables=zonetesttableduplicate.csv" --om "net=tabletestout2_%outputsuffix%.shp" "linkonly" >>testout_table_%outputsuffix%.txt 
%pythonexe% -u ..\..\..\arcscripts\bin\sdnaintegral.py --dll %sdnadll% --im "net=skimtest" --om "skim=testout_od_skim_%outputsuffix%.csv" "radii=n;outputskim;skimzone=zone;nonetdata;metric=euclidean" >>odtestout_stdout_%outputsuffix%.txt 2>>&1
%pythonexe% -u ..\..\..\arcscripts\bin\sdnaintegral.py --dll %sdnadll% --im "net=skimtestzeroweight" --om "skim=testout_od_skimzeroweight_%outputsuffix%.csv" "radii=n;outputskim;skimzone=zone;nonetdata;metric=euclidean;weight=weight" >>odtestout_stdout_%outputsuffix%.txt 2>>NUL
%pythonexe% -u ..\..\..\arcscripts\bin\sdnaintegral.py --dll %sdnadll% --im "net=odtest;tables=testodmatrix.csv" --om "net=odtestoutsparse_%outputsuffix%" "radii=n;odmatrix" >>odtestout_stdout_%outputsuffix%.txt 2>>&1
%pythonexe% -u ..\..\..\arcscripts\bin\sdnaintegral.py --dll %sdnadll% --im "net=odtest;tables=testodmatrix-nonsparse.csv" --om "net=odtestoutnonsparse_%outputsuffix%" "radii=n;odmatrix" >>odtestout_stdout_%outputsuffix%.txt 2>>&1

I've worked around this in my Pytest runner, but you might not choose to include that, and regardless it's better to fix the problem at its source and use the env var consistently.

JamesParrott added a commit that referenced this issue Mar 9, 2024
…e_workflows_into_Actions

Ci refactor tests and compile workflows into actions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant