Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions lib/cartopy/tests/test_coding_standards.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@
# licensing details.

from fnmatch import fnmatch
import os
from pathlib import Path
import re
import subprocess

import pytest

import cartopy


# Add shebang possibility or C comment starter to the LICENSE_RE_PATTERN
SHEBANG_PATTERN = r'((\#\!.*|\/\*)\n)?'
Expand All @@ -29,12 +26,11 @@
LICENSE_RE_PATTERN = re.escape(LICENSE_TEMPLATE)
LICENSE_RE = re.compile(SHEBANG_PATTERN + LICENSE_RE_PATTERN, re.MULTILINE)


# Guess cartopy repo directory of cartopy - realpath is used to mitigate
# against Python finding the cartopy package via a symlink.
CARTOPY_DIR = Path(cartopy.__file__).parent.resolve()
REPO_DIR = Path(os.getenv('CARTOPY_GIT_DIR',
CARTOPY_DIR.parent.parent))
# Get repo directory for cartopy (https://stackoverflow.com/a/53675112)
REPO_DIR = subprocess.Popen(['git', 'rev-parse', '--show-toplevel'],
stdout=subprocess.PIPE
).communicate()[0].rstrip().decode('utf-8')
REPO_DIR = Path(REPO_DIR)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to keep supporting CARTOPY_GIT_DIR?

Suggested change
REPO_DIR = Path(REPO_DIR)
REPO_DIR = Path(os.getenv("CARTOPY_GIT_DIR", REPO_DIR))



class TestLicenseHeaders:
Expand Down