Skip to content

Commit

Permalink
feat: Implemented better backoff version checking and added unit test…
Browse files Browse the repository at this point in the history
… for the feature
  • Loading branch information
Buduzz committed Nov 1, 2022
1 parent fa19e1f commit df04db5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

import toml

deps = toml.load('./exporter/opentelemetry-exporter-otlp-proto-grpc/pyproject.toml')['project']
dependencies = deps['dependencies']
backoff = dependencies[0].split(';')[0]
info = backoff.split()
package_name = info[0]
package_version = info[-1]

pkgs = dict([(package_name, package_version)])


def package_version(r):
def wrapper(f):
r.version = pkgs[f]
return r
return wrapper

@package_version
def get_distribution(package_name):
return pkgs[package_name]

Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,8 @@ def trailing_metadata(self):
"while exporting mock, retrying in 0s."
),
)

def test_backoff_version_checking(self):
import pkg_resources
backoff_version = pkg.get_distribution('backoff').version
self.assertEqual(backoff_version, '2.0.0')

0 comments on commit df04db5

Please sign in to comment.