prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Dual distro support broke "securedrop-admin verify"
  ## Description
  
  When adding support for Focal to the configuration tests in #5529, a check of the `MOLECULE_SCENARIO_NAME` environment variable broke `securedrop-admin verify`, where it's not set.
  
  ## Steps to Reproduce
  
  On an admin workstation:
  - Run `securedrop-admin setup -t`
  - Run `securedrop-admin verify`
  
  ## Expected Behavior
  
  That the configuration tests would run.
  
  ## Actual Behavior
  
  You get an error [here](https://github.com/freedomofpress/securedrop/blob/76d133a7e5962f8d904e507d93e6a61575358eeb/molecule/testinfra/conftest.py#L31) saying `'NoneType' object has no attribute 'endswith'`. 
  
  ## Comments
  
  Should probably check if it's `None` or just add `""` as the default in the `os.environ.get` call.
  
  </issue>
  <code>
  [start of molecule/testinfra/conftest.py]
  1 """
  2 Configuration for TestInfra test suite for SecureDrop.
  3 Handles importing host-specific test vars, so test functions
  4 can be reused across multiple hosts, with varied targets.
  5 
  6 Vars should be placed in `testinfra/vars/<hostname>.yml`.
  7 """
  8 
  9 import io
  10 import os
  11 import yaml
  12 import testutils
  13 
  14 # The config tests target staging by default. It's possible to override
  15 # for e.g. prod, but the associated vars files are not yet ported.
  16 target_host = os.environ.get('SECUREDROP_TESTINFRA_TARGET_HOST', 'staging')
  17 
  18 
  19 def securedrop_import_testinfra_vars(hostname, with_header=False):
  20     """
  21     Import vars from a YAML file to populate tests with host-specific
  22     values used in checks. For instance, the SecureDrop docroot will
  23     be under /vagrant in development, but /var/www/securedrop in staging.
  24 
  25     Vars must be stored in `testinfra/vars/<hostname>.yml`.
  26     """
  27     filepath = os.path.join(os.path.dirname(__file__), "vars", hostname+".yml")
  28     with io.open(filepath, 'r') as f:
  29         hostvars = yaml.safe_load(f)
  30 
  31     if os.environ.get("MOLECULE_SCENARIO_NAME").endswith("focal"):
  32         hostvars['securedrop_venv_site_packages'] = hostvars["securedrop_venv_site_packages"].format("3.8")  # noqa: E501
  33         hostvars['python_version'] = "3.8"
  34     else:
  35         hostvars['securedrop_venv_site_packages'] = hostvars["securedrop_venv_site_packages"].format("3.5")  # noqa: E501
  36         hostvars['python_version'] = "3.5"
  37 
  38     if with_header:
  39         hostvars = dict(securedrop_test_vars=hostvars)
  40 
  41     return hostvars
  42 
  43 
  44 def lookup_molecule_info():
  45     """
  46     Molecule automatically writes YAML files documenting dynamic host info
  47     such as remote IPs. Read that file and pass back the config dict.
  48     """
  49     molecule_instance_config_path = os.path.abspath(
  50             os.environ['MOLECULE_INSTANCE_CONFIG'])
  51     with open(molecule_instance_config_path, 'r') as f:
  52         molecule_instance_config = yaml.safe_load(f)
  53     return molecule_instance_config
  54 
  55 
  56 class Myvalues:
  57     def __init__(self):
  58         pass
  59 
  60 
  61 value = securedrop_import_testinfra_vars(target_host)
  62 res = Myvalues()
  63 for key, value in value.items():
  64     setattr(res, key, value)
  65 testutils.securedrop_test_vars = res
  66
  [end of molecule/testinfra/conftest.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/molecule/testinfra/conftest.py b/molecule/testinfra/conftest.py
  --- a/molecule/testinfra/conftest.py
  +++ b/molecule/testinfra/conftest.py
  @@ -28,7 +28,16 @@
       with io.open(filepath, 'r') as f:
           hostvars = yaml.safe_load(f)
   
  -    if os.environ.get("MOLECULE_SCENARIO_NAME").endswith("focal"):
  +    # Testing against both Focal and Xenial must be supported for now in both
  +    # staging scenarios, and in prod via `USE_FOCAL=1 ./securedrop-admin verify`
  +    testing_focal = False
  +    scenario_env = "MOLECULE_SCENARIO_NAME"
  +    if scenario_env in os.environ and os.environ.get(scenario_env).endswith("focal"):
  +        testing_focal = True
  +    if "USE_FOCAL" in os.environ:
  +        testing_focal = True
  +
  +    if testing_focal:
           hostvars['securedrop_venv_site_packages'] = hostvars["securedrop_venv_site_packages"].format("3.8")  # noqa: E501
           hostvars['python_version'] = "3.8"
       else:
  
verification_info: {"golden_diff": "diff --git a/molecule/testinfra/conftest.py b/molecule/testinfra/conftest.py\n--- a/molecule/testinfra/conftest.py\n+++ b/molecule/testinfra/conftest.py\n@@ -28,7 +28,16 @@\n     with io.open(filepath, 'r') as f:\n         hostvars = yaml.safe_load(f)\n \n-    if os.environ.get(\"MOLECULE_SCENARIO_NAME\").endswith(\"focal\"):\n+    # Testing against both Focal and Xenial must be supported for now in both\n+    # staging scenarios, and in prod via `USE_FOCAL=1 ./securedrop-admin verify`\n+    testing_focal = False\n+    scenario_env = \"MOLECULE_SCENARIO_NAME\"\n+    if scenario_env in os.environ and os.environ.get(scenario_env).endswith(\"focal\"):\n+        testing_focal = True\n+    if \"USE_FOCAL\" in os.environ:\n+        testing_focal = True\n+\n+    if testing_focal:\n         hostvars['securedrop_venv_site_packages'] = hostvars[\"securedrop_venv_site_packages\"].format(\"3.8\")  # noqa: E501\n         hostvars['python_version'] = \"3.8\"\n     else:\n", "issue": "Dual distro support broke \"securedrop-admin verify\"\n## Description\r\n\r\nWhen adding support for Focal to the configuration tests in #5529, a check of the `MOLECULE_SCENARIO_NAME` environment variable broke `securedrop-admin verify`, where it's not set.\r\n\r\n## Steps to Reproduce\r\n\r\nOn an admin workstation:\r\n- Run `securedrop-admin setup -t`\r\n- Run `securedrop-admin verify`\r\n\r\n## Expected Behavior\r\n\r\nThat the configuration tests would run.\r\n\r\n## Actual Behavior\r\n\r\nYou get an error [here](https://github.com/freedomofpress/securedrop/blob/76d133a7e5962f8d904e507d93e6a61575358eeb/molecule/testinfra/conftest.py#L31) saying `'NoneType' object has no attribute 'endswith'`. \r\n\r\n## Comments\r\n\r\nShould probably check if it's `None` or just add `\"\"` as the default in the `os.environ.get` call.\n", "before_files": [{"content": "\"\"\"\nConfiguration for TestInfra test suite for SecureDrop.\nHandles importing host-specific test vars, so test functions\ncan be reused across multiple hosts, with varied targets.\n\nVars should be placed in `testinfra/vars/<hostname>.yml`.\n\"\"\"\n\nimport io\nimport os\nimport yaml\nimport testutils\n\n# The config tests target staging by default. It's possible to override\n# for e.g. prod, but the associated vars files are not yet ported.\ntarget_host = os.environ.get('SECUREDROP_TESTINFRA_TARGET_HOST', 'staging')\n\n\ndef securedrop_import_testinfra_vars(hostname, with_header=False):\n    \"\"\"\n    Import vars from a YAML file to populate tests with host-specific\n    values used in checks. For instance, the SecureDrop docroot will\n    be under /vagrant in development, but /var/www/securedrop in staging.\n\n    Vars must be stored in `testinfra/vars/<hostname>.yml`.\n    \"\"\"\n    filepath = os.path.join(os.path.dirname(__file__), \"vars\", hostname+\".yml\")\n    with io.open(filepath, 'r') as f:\n        hostvars = yaml.safe_load(f)\n\n    if os.environ.get(\"MOLECULE_SCENARIO_NAME\").endswith(\"focal\"):\n        hostvars['securedrop_venv_site_packages'] = hostvars[\"securedrop_venv_site_packages\"].format(\"3.8\")  # noqa: E501\n        hostvars['python_version'] = \"3.8\"\n    else:\n        hostvars['securedrop_venv_site_packages'] = hostvars[\"securedrop_venv_site_packages\"].format(\"3.5\")  # noqa: E501\n        hostvars['python_version'] = \"3.5\"\n\n    if with_header:\n        hostvars = dict(securedrop_test_vars=hostvars)\n\n    return hostvars\n\n\ndef lookup_molecule_info():\n    \"\"\"\n    Molecule automatically writes YAML files documenting dynamic host info\n    such as remote IPs. Read that file and pass back the config dict.\n    \"\"\"\n    molecule_instance_config_path = os.path.abspath(\n            os.environ['MOLECULE_INSTANCE_CONFIG'])\n    with open(molecule_instance_config_path, 'r') as f:\n        molecule_instance_config = yaml.safe_load(f)\n    return molecule_instance_config\n\n\nclass Myvalues:\n    def __init__(self):\n        pass\n\n\nvalue = securedrop_import_testinfra_vars(target_host)\nres = Myvalues()\nfor key, value in value.items():\n    setattr(res, key, value)\ntestutils.securedrop_test_vars = res\n", "path": "molecule/testinfra/conftest.py"}]}