Skip to content

Commit

Permalink
Fix syntax issue
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Algarvio <[email protected]>
  • Loading branch information
s0undt3ch committed Aug 25, 2022
1 parent f2dd261 commit 03a438a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/kitchen/verifier/nox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Nox < Kitchen::Verifier::Base
default_config :sys_stats, false
default_config :environment_vars, {}
default_config :zip_windows_artifacts, false
default_config :pytest_nox_session, false

def call(state)
create_sandbox
Expand Down Expand Up @@ -113,6 +114,12 @@ def call(state)
noxenv = "pytest-zeromq"
end

if noxenv.start_with?("test-")
config[:pytest_nox_session] = true
elsif noxenv.include?("pytest")
config[:pytest_nox_session] = true
end

# Is the nox env already including the Python version?
if not noxenv.match(/^(.*)-([\d]{1})(\.([\d]{1}))?$/)
# Nox env's are not py<python-version> named, they just use the <python-version>
Expand All @@ -125,7 +132,7 @@ def call(state)
end
noxenv = "#{noxenv}(coverage=#{config[:coverage] ? 'True' : 'False'})"

if noxenv.start_with?("test-") || noxenv.include? "pytest"
if config[:pytest_nox_session]
tests = config[:tests].join(' ')
if config[:sys_stats]
sys_stats = '--sys-stats'
Expand All @@ -142,7 +149,7 @@ def call(state)

if config[:junitxml]
junitxml = File.join(root_path, config[:testingdir], 'artifacts', 'xml-unittests-output')
if noxenv.start_with?("test-") || noxenv.include? "pytest"
if config[:pytest_nox_session]
junitxml = "--junitxml=#{File.join(junitxml, "test-results-#{DateTime.now.strftime('%Y%m%d%H%M%S.%L')}.xml")}"
else
junitxml = "--xml=#{junitxml}"
Expand Down

0 comments on commit 03a438a

Please sign in to comment.